I have a script that makes and plays a sin wave of a certain hz out of an audiosource with the OnAudioFilterRead() method. After copying and pasting the object about 50 times (and changing the hz for each object), I noticed when I hit play some of the objects don't have the green bar under the gain variable. When I try to play the sin wave from those objects, there is no sound
what is wrong?
(btw, I don't think is with the code variables because I changed them around and It's still broken for some objects. I can share the code if you'd like)
Edit:
Closing out of the game/restarting doesn't help
if I remove and add back the script unity crashes
Edit 2:
I've found part of the bug!!
it has to do with the sheer amount of audiosources. So changing the priority can switch sources on/off. However, this still isn't a fix at least 88 audio sources are required for my game to function without any compromises, and even 50 is enough to break it.
Edit 3:
This game is based around music and processing power/speed is not an issue
Potential Fixes:
- A way to deal with this too many audiosources problem (preferred fix)
- A way to play multiple sounds at once from one audiosource
- compromising the game's functionality (for example taking out some audiosources and/or dynamically changing priority of the audioSources)
Edit 4: Fixed!!
I increased the max virtual voices 🙂