I’m getting a strange low memory crash in my build on the iPhone, but I’m not sure why. It happened after I added a couple more sounds (I’m up to around 20, preloaded on a game object in the intro scene that is kept in place by DontDestroyOnLoad). I’m not sure what set it over the edge, but it seemed, after I compessed them to mp3, the crash happened later (still between loading scenes).
Any suggestions on tracking this bugger down? I’m at a complete loss, and I don’t want to remove sounds if I don’t have to (besides, I think it’s a memory leak of some type.)
run it through instruments so you can see what’s going on. also have you rebooted your iPhone lately? it won’t clean up released memory until you do which can cause memory probs.
20 sounds preloaded on a game object are a good reason for crashing as thats a massive amount of memory already with AAC files, not counting in the consequence of wav
Thanks for the replies guys. I really appreciate it!
Dreamora, is there a better way to load (and/or unload) sound effects? Should I just call them all individually? In this instance, a tick of performance hitch isn’t nearly as bad as a full blown crash
optimally you would load them when you require them, play them and then destroy them again so they don’t float around in memory uselessly.
And I would consider reducing the amount of sounds … 20 that need to be cached at the same time sounds like a lot for a device that would be fully eaten up if only half those sounds were played in parallel, without the 3d work.
Ok, I’ve gone through and put all the sounds on prefabs and instantiate/destroy them throughout my various scripts, but I’m still getting the error… Is there anything I can do to track this down? If it’s not coming from the audio, I’m lost as to how to find it!
Brady found that when he was switching between scenes there was a bug relating to the use of compressed MP3 audio. He said after using an uncompressed version of the same sound, it worked fine and stopped crashing.