My game has 50 animals, each making unique sounds. When the game starts up, 5-25 random animals will be on the screen (it will be different between each player). When player picks up an animal, the animal makes a noise.
I don’t want to preload all 50 animal sounds at the beginning of the game because the player might not need all of the sounds (if they only see 5 and then leave the game).
Right now, I have it so when the player picks up an animal, it preloads that sound and plays it. But if the player picks up the same animal 3 times in a row, it will preload the sound 3 times. Is there a way to detect if a sound has been preloaded so as not to load it again?
Or is there a better way for me to do this? Any suggestions please.
Along those lines, unloading effects would requiring knowing which sounds were loaded. I am thinking of tracking the loaded sounds in a list and then looping through it to unload in the end. Is this correct?
Thank you for your help!