Need help with memory management

Hi,

I’ve got a fairly robust game that is broken up into primarily 2 scenes. One is the front end menu system which is based on EZ-GUI. The other is the game portion. We work fine under iOS, except that on iPad1 we can enter the game scene once. If we try to return from the game scene to the front end scene, we crash due to running out of memory.

Clearly this is not acceptable, especially since the game obviously works well in both the scenes. It is apparently just transitioning back that is causing problems. My guess is that garbage collection is not timely enough to clean up after the one scene unloads and the other begines loading.

Our game scene has 3 large prefabs that get loaded via Instantiate( Resources.Load( … ) ). One is a simple mesh with texture and the other two are skinned/animated mesh objects. Their textures and animations are also loaded via Instantiate( Resources.Load( … ) ). So I tried to clean this up prior to loading the front end scene when transitioning back to the front end by calling DestroyImmediate() for each of the 3 objects in question, followed immediately by

yield return Resources.UnloadUnusedAssets();

and upon return from the yield, finally calling Application.LoadLevel(). All of this is, of course, is done in a Coroutine.

Alas, this made no difference at all. We still crash when we try to return to the front end scene.

Any ideas on what I’m doing wrong to free these objects? Any other ideas on how to “cleanly” free up enough memory to switch our scenes back to the front end? Any help would be appreciated. FWIW, all of our code is C#.

Thanks in advance,

= Ed =

Bump/ Really? No has dealt with this?

= Ed =