The script has been written so that it is easy to have multiple visualizations in a scene. So, to create a second visualizer for a second audio clip in the scene, perform the following steps:
- Duplicate the visualizer GameObject.
- Drag a different audio clip from the Project panel into the AudioSource component of your new GameObject.
- Set the startY public parameter in the Inspector panel to 60 (so that the new row of cubes will be above the original row).
- In the Inspector panel, choose a different Display Color public variable for the SpectrumCubes (Script) component:
Figure 4.6 – Two visualizer GameObjects in play mode