- Home /
iPhone game turns off unexpectedly
Hi,
Lately I've come across a really strange behaviour in my game. I have been trying to debug it for a few days now but I still can solve this.
I'm using XCode 3.1.4 and publishing 2.2.1 build for compatibility reasons.
The problem is:
When I run the build on my iPod Touch 2nd gen 8gb (3.1.3), the game turns on and when it get to loading the main menu it just turns off, unexpectedly. Sometimes, it does load it and sometimes not. Same happens for loading my main scene( when I manage go get to that point).
I tried removing objects from my scenes, cutting down on side by removing audio, etc. Yet I still can not get to the cause. I also tried restarting my iPod touch but it doesn't seem to help either.
If someone had the same experience or know what the cause is, please let me know.
NOTE: everything works absolutely fine in the unity iPhone editor.
Answer by spinaljack · Aug 02, 2010 at 11:37 AM
Your game is probably using too much RAM, if it goes over 25MB there's a chance that the device will simply stop the process depending on what other programs are running, which might explain the randomness of the cut outs. Other than compressing every sound file and texture you have you can also try not to maintain pointers to objects and store as few variables as possible.
Also removing debug symbols and using code stripping if you haven't already will help, removing unused libraries and frameworks will save you some memory.
If you're sure you're well under the safe memory limit then there might be exceptions in your game. The device doesn't handle exceptions so check through your code with a fine tooth comb.
Ok thanks, but one more thing. What if I add a very small loading scene between the memory consu$$anonymous$$g big scenes?
Loading scenes is a very slow process on iPhone so it'll be very noticeable and it wouldn't have much effect in solving your problem.
Oh man! Solved it!!! You were absolutely correct that "literally" loading a big scene with a loading scene is slow. I think I found another way.
I created a "Fake" loading scene with just one "Loading image" and a script that yields for 2 secs and then loads the next big scene.
$$anonymous$$y game doesn't just turns off anymore so that's perfect.
Thanks for your help, I really appreciate it.