My app got rejected because apparently it crashes at launch. It does it for them but not for me… How do you fix an invisible problem?
They sent me the crash log (attached). I did some research on the forum. Someone suggested to make simple empty scene that would yield for a frame an then load the real level. That’s worst. Now it crashes for me too.
Program received signal: “0”.
warning: check_safe_call: could not restore current frame
The crash log tells me that the app didn’t load in time. Well, that’s what I could figure out by this : Exception Codes: 0x8badf00d
Now what? What can I do?
187662–6634–$attachment_80970795_607.zip (8.45 KB)
If you app doesn’t load within a certain time, it gets killed by the OS.
Make your first scene in the project an empty scene, and load the first real scene with Application.LoadLevel().
I tried it. That’s what I said in my second paragraph. 
How much memory is your app using right after it loads successfully? Crashes are almost always memory related, or a null reference or other scripting error (which can probably be ruled out since it doesn’t always crash for you).
I tried something. I have a bunch (about 12) of gui textures that are full screen. So they are 480 x 320 jpgs. I use them for my logo, the main menu, the instructions and between the levels.
I get these stats:
Real memory tops at 57.44 megs and virtual memory at 123.46
If I scale all the images at 512 x 512 compressed then I get this:
Real memory tops at 33.44 megs and virtual memory at 93.5
I know that texture compression helps but there’s no way it could take an extra 24 megs of Ram just for that! Plus another 30 in virtual memory? And because they are scaled and compressed they look like crap.
What should be a reasonable amount of memory for an iPhone game? My game is not CPU intensive. I have a maximum of 13 draw calls. 3.4k verts. All my 3D textures are 64 x 64 pixels.
yes there is.
texture compression reduces the memory use of textures by 7/8 or 15/16 depending on if you use bpp2 or bpp4
normally a 512x512 is 1.3mb of RAM, each texture where you don’t uncheck getpixels / setpixels actually uses VRAM and RAM
You are crashing from using too much memory.
It’s been posted many times by many people, but I’ll post it here again:
- Make your texture dimensions powers of 2 -
Textures on iPhone (not just unity, iPhone in general) have to have power of 2 dimensions. They don’t have to be square (i.e. 256x256 or 512x512) unless you’re using compression also, but you should use compression whenever you can possibly get away with it. If you bring in a texture that is 480x320, or some other non power-of-two size on one side or another, Unity will scale them up for you, but in the process convert them to an enormous size, wasting massive amounts of memory. So a 17x19 texture (a tiny, non power-of-two dimension) would use a HUGE amount of memory.
Again, if you’re using compression, your textures also have to be square, but at the very minimum you must keep your textures with power-of-two dimensions, even if that means adding “empty space” to reach the next highest power-of-two size (i.e. bringing a full screen 480x320 image up to 512x512). Further, whatever source format your assets are is meaningless - it doesn’t matter if you’re using .PNG, .JPG, or whatever. As far as iPhone is concerned, there are two texture formats - Uncompressed (Huge and lossless) or PVRTC (tiny and sometimes ugly).
I read about the compression but I also read somewhere that textures where not compressed for gui textures. I will try to play with the compression and the setPixel getPixel thing. I will probably have to do a lot of interface redesign too to try to eliminate as many images as possible.
Can one of you guys tell me what I should aim for as far as memory usage (besides "as little as possible) 
Thanks guys!
i thought 1.0.3 automagically forced all textures to be a power of 2
Unity always did.
if a texture is not pow2 it will just be extended internally.
… but you shouldn’t rely on this, because it apparently scales it up to the maximum size in order to accomplish this (1024x1024). Some users have reported tiny textures being bloated up to huge proportions because they were not power of 2 dimensions.
The iPhone OS is a bit screwy and there’s no exact threshold at which an app will be closed down. The first release of Zombieville used over 40mb, was approved by Apple, and never crashed for me, but it did for some early users (most of whom were using jailbroken devices, which are prone to crashing if the user is running a bunch of extra garbage on it). I streamlined my textures in later releases, and now it uses in the mid-30’s and I never get crash reports anymore, so my personal experience suggests that mid-30’s or less is okay, and under 30 is ideal if you can get there.
PVRTC makes a huge difference, reducing texture sizes by at least 75%, so definitely enable it for any textures you can without making your visuals ugly. I find that PVRTC is less destructive on larger images that are then scaled down - for instance, I use 256x256 compressed textures for my character sprites, and you can barely see any artifacts at all because the are actually fairly small on screen (closer to 128x128 in practice). A 128x128 UNcompressed texture would still use double the memory of a 256x256 compressed texture, and they look almost identical rendered at the same size.
I only use uncompressed textures for UI elements.
hu?
I was under the impression that it extends it to the next larger pow2 textures actually …
but yeah don’t use automatisms that waste texture memory for nothing, thats stupid and inacceptable even for want to be mobile devs as mobile devices don’t have a fulltime power connection so any unrequired use of cpu or gpu time is a bad thing!
Well I haven’t tested it myself, dreamora, but I recall reading threads where people were claiming tiny textures (like 20x20 pixels) taking up a meg of RAM or something outrageous, and that making the textures powers of 2 solved it.
I heard such stories from people that used 320x3xx and alike which are expanded to 512x512 which would fit into 1mb … 1024x1024 would actually be 4-5mb depending on the mipmap settings
Well, thanks to you guys my app now is running under 32 megs and it’s way much faster to load. I can tell that the full screen images are compressed but it’s not that bad. I can tell but 99% of the people who will play the game won’t.
So I’m submitting again tonight. Now it should be ok.
Thanks again!
PS: I put the Unity3D community in the credits!