Uncovering the details

Now that we have seen the completed demo, let's see how this all works under the covers by following the instructions:

  1. Open up Unity and locate the VisualizeSoundManager script in the Project window and double-click on the script to open it in your preferred editor. Unlike previous chapters, we are not going to look at the entire script but just look at the highlights.
  2. Start by scrolling down to the Start method, as shown here:
void Start () {   audioSource = GetComponent<AudioSource>();   samples = new float[sampleNo];   CreateFrequencyBins(); }
  1. The Start method should be very familiar to you by now. First, we get the audioSource component, initialize an array called samples, and finally call the method CreateFrequencyBins ...

Get Game Audio Development with Unity 5.X now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.