I’m having huge problems with an otherwise finished game (minigolf-style):
The compiled game crashes after playing for 20 minutes or so. Before crashing it keeps getting slower, so I think it’s a memory issue.
I don’t think it’s the size of the app (33.4MB) and it certainly has nothing to do with the number of currently loaded textures / models (to give you an idea about the game: http://daredevil.three-2-one.com/downloads/ScreenFlow.mov)
I tried some tips I’ve found in this forum (thanks by the way!):
- Resized all textures to a power of 2. However, some GUI textures are not square size (e.g. 256x32) – not sure if I needed to make them square, too
resulted in a smaller file size
- Reorganized the whole scene structure: I had just a single scene with levels being loaded into it. Changed it to:
- “init” scene, with just a splash screen and some global data
- “start” scene with main nav
- “game” scene with game mechanic and loader for “level1 … 18”
resulted in shorter startup times
- Added triggering the garbage collection after loading stuff
seems to make crashes less likely, but still crashes …
- Tried disabling the (great) iPhone Enhancement pack
no improvements
Another issue: after compiling I get a “Reply contains invalid hex digit 116” in XCode …
Pretty frustrating at that point … any other suggestions what I could try?
Are there any Unity iPhone games out there without memory problems?
Many thanks in advance,
Jörg
Have you run your app with activity monitor to see how much RAM your app is really using? Also, when you do a normal “build and go” from xCode you can check the console for a line that reads something like… Application.DidRecieveMemoryWarning… which indicates you’ve entered the danger zone where the OS may forcibly close your app down.
My app starts with 20MB on the start screen and peaks at 35MB. Strange thing is that memory doesn’t seem to be released completely – as the levels progress, memory consumption grows up to 35MB, but as I start the first level again, it starts with 30MB memory …
I checked for memory leaks but didn’t find any …
I believe there’s a known bug about memory not being released properly when loading between levels. There have been other forum posts on this very subject. I ran into major problems with it on my game, and was forced to combine the two levels I was using (main menu and game itself) into a single level.
That said, your app shouldn’t be crashing at 35mb, that’s definitely within safe territory.
joerg - I can’t help you with your memory issue but I did watch your video and the game looks pretty slick.
If you don’t already have it planned, the camera needs to follow the ball or at the very least reset to behind the ball looking at the hole when it stops moving. The click and drag to line up the shots looks really well done. A simple and elegant solution.
Just my $0.02 : )
PirateNinjaAlliance: thanks for your replies – haven taken a look at your thread about memory issues I’ll try to reduce memory even more. Second I will do some stress tests with the different loading mechanisms to check what works best (app.loadlevel vs. resource.load).
se7en: thanks for the praise - we don’t want to make it too easy for the player, so an auto-orientation player-in-a-straight-line-with-ball-and-hole is a no-go. The video actually doesn’t show it’s possible to rotate the course by tilting the device. This is getting bit off-topic – send me a pm with your device id and I’ll provide you a test version.