Randomizing audio is the practice of tuning an audio source playback in a random manner to avoid exact repetition in your games audio. Of course, another way to avoid audio repetition is create multiple sound effects for the same noise, music or dialog, and then randomly select one each time the audio needs to be played. While using multiple variations of the same audio clip is preferred it does increase memory resource usage and asset management.
For this section, we are going to borrow a couple techniques we already used to slightly alter or randomize the playback of our audio without needing to provide multiple variations. Open up Unity and follow the following exercise to randomize the scene audio:
- Locate the axController script in the Project window and then double-click on the script to open it in your editor.
- Scroll down to around line 21 as shown here...