Unity 2018 Cookbook(Third Edition)
上QQ阅读APP看书,第一时间看更新

Adding visualizations to a second AudioSource

The script has been written to be easy to have multiple visualizations in a scene. So to create a second visualizer for a second AudioClip in the scene, do the following:

  1. Duplicate the visualizer GameObject.
  2. Drag a different AudioClip from the Project panel into the Audio Source component of your new GameObject.
  1. Set the Start Y public parameter in the Inspector to 60 (so the new row of cubes will be above the original row).
  2. In the Inspector, choose a different Display Color public variable for the SpectrumCubes (Script) component: