It's great fun to watch the visualization of the loop sounds as they play together. To add visualizations to the four AudioSources, perform the following steps:
- Import the SpectrumCubes.cs C# script file from the previous recipe into this project.
- Select the Main Camera in the Hierarchy panel. Then, in the Inspector panel, set the Transform Position to (224, 50, -200).
- With the Main Camera still selected, set the Camera in the Inspector panel to have the following settings: Projection = Perspective, Field of View 60, and Clipping Planes 0.3 - 300.
- Add a DirectionalLight GameObject to the scene.
- For each of the four GameObjects containing your AudioSources, add an instance of the SpectrumCubes script class.
- In the Inspector panel for the Spectrum Cubes (Script) component, change the displayColors variable for each AudioSource GameObject.
- Set the startY values of the Spectrum...