Optimize a scene to reduce the memory use at minimum. Prevent IOS to shutdown the app

Hi,

I’m really at the end of the development of my game and I’ve got a memory issue. When I arrive to the end of level, I’ve got a screen that gives the user his score and ask him if he wants to post it on facebook. If the user is login to facebook for the first time, the app is going to switch to the facebook app and ask him for publish permission. But when the game is swapped to the facebook app the ipad shutdown the game to release the memory… Obviously I absolutely do not want that I want the app to swap back to my game.

I’ve tested the code on an empty scene and it works fine the app isn t shut down by the ipad. I already spent a lot of time reducing all the textures to the minimum.

So here are my questions:

  • Is there any way to prevent IOS to shutdown my app ?
  • Is there any way to “clean” the memory from everything that is unused in the scene anymore (sounds, textures, etc) before calling the facebook login etc and yet still be in the scene ?
  • Most of the sounds of my scene are in Wav format (except the musics) Should I put them in mp3 (within unity) without having to be scared of killing the processor by asking to decompress a lot of sounds while playing? (all of the sounds are 2d sounds). What settings do you use in general?
  • Textures and sounds apart where can I look for memory issues ?
  • Any ideas that could help me in this situation ?

As most of the gameplay is tactile, the game is really difficult to test from unity, so I’m not sure I can use the profiler in this case, I should have done that in an easier testable way from the start (an error I won’t make twice that s for sure…). The only way to see how it goes (for what I know) is the fps count in Xcode. Any suggestions on how to check in real time where the memory is used ?

Thanks a lot for your help!

B.

Hey look, my settings on iOS:

Sound Effects = waw is best
Music = mp3 (i think) is best

If i xchange the Sound Effects to MP3 i got slowdown on my game.
About the performance, use the Built-In Unity and XCode tools to see what is eating too much memory;