I’m working on a music game for iOs where you have about 20 instruments available to drag into the scene. The audio for each instrument only plays when it is dragged into the scene, and only a maximum of 6-7 can be in the scene at one time. I am finding it to be a huge memory hog to have all 20 audio clips loaded into memory at once. What is the best way to play load the clips into memory only when I need them, and unload audio clips when they are removed from the scene?
Currently, I have a script for each instrument with an audio clip that I assign in the inspector. Each instrument has its own audio source and I simply call audio.Play() and audio.Stop() when the instrument is dragged into/out of the scene. There’s got to be a better way!
Thanks for your help.