I created an Audio Manager with a script that generates multiple audio sources on the Audio Manager game object at runtime.
I have 2 music tracks that play at the same time, one at a volume of 0, one at a volume of 1. I wrote an IEnumerator to perform fades on the sounds in the array. When I call it, I can clearly see the volume slider of the associated clip in the array going down to 0, as expected. But the audio source that corresponds to that clip maintains its volume at 1, despite the fade executing in the array.
I have no idea why the audio source volume (the one created at runtime from the array) has a separate volume value from the corresponding clip in the array. I’m new to all this stuff. Do I need to somehow update the audio source volume with a separate line of code, copied from the value in the array?
If I use GetComponent().volume and set it to the value of the clip in the array, it works, because the theme song I’m trying to fade is the FIRST clip of the array. I understand why this solution doesn’t work. But I’m scratching my head trying to figure out how to solve this. I need to be able to cross fade both the first AND second clip of the array.