Quick-Start


  1. Make sure your project is set to build to the WebGL platform.
  2. Download Amplitude from the Unity Asset Store.
    • Menu Select:  Window > Asset Store > select your downloads
    • Browse to:  Amplitude > Import
  3. Create a new scene.
  4. Create a new Empty.
  5. Create a UI Slider so you can see the results in the WebGL build. You can position the sliders direction using the Slider Inspector.
  6. Create an AmplitudeTester.cs test script to link the Amplitude average output to the Unity UI Slider.
    • 
      using UnityEngine;
      using UnityEngine.UI;
      using System.Collections;
      using CrazyMinnow.AmplitudeWebGL;
      
      public class AmplitudeTester : MonoBehaviour 
      {
      	public Amplitude amplitude;
      	public Slider slider;
      
      	void Update () 
      	{
      		if (amplitude.audioSource.isPlaying)
      		{
      			slider.value = amplitude.average;
      		}
      	}
      }
      
  7. Add the following components to your Empty GameObject:
    • AudioSource
    • Amplitude
    • AmplitudeTester
  8. Add an AudioClip to your AudioSource component, and check the boxes next to [Play On Awake] and [Loop].
  9. Link the AudioSource component to the Amplitude.audioSource public property.
  10. Link the Amplitude component to the AmplitudeTester.amplitude public property.
  11. Link the Unity UI Slider to the AmplitudeTester.slider public property. 
  12. Build the scene to WebGL and enjoy!