I was working on a game sometime ago and have had a working project. Few weeks later the team did add some new textures to the project and the game began to crush on the device with some memory warnings after loading the second level. After two days I pushed the “compress textures” and the game is working again.
OK, now my question. I’m 100% sure that none of the new assets have been used in any of two levels that cause the crash! It seams that presence of new textures in the data did make a difference. Is unity loading or pre caching any resources before even the level will instantiate one ?
All textures used in a level are loaded to ram when the level is loaded.
According to your settings either to RAM and on need to VRAM or only to VRAM (-> get / set pixel checkbox)
Assets are not loaded on demand if they are placed through the editor, you need to load them on your own through Resources.xxx and Instantiate and keep the corresponding data in the resources folder to be included in the build.
Maybe in my case the problem is that the first loaded level uses quite a lot of textures and then it loads (NOT incrementally) another level with different set of textures. The problem appears during the loading. First of all the second level loads very very long. I placed some log lines in Awake functions of the GameObjects in the second level. There are only two GameObjects that contain almost nothing, one of them is instantiating all level assets. But the code never make it to the instantiation, it didn’t even make it to the Awake log!
It seams like unity was unable to proper free all of the assets from previous level and it is kind of predicting what will happen in the newly loaded one.
The iphone cpu and memory isn’t really fast, so unloading isn’t a “click and done” thing. If you flood the RAM to near its maximum and then switch to the next scene, you can expect that the unloading already takes seconds.
A common trick with 1.0.x to ensure the lowest possible memory usage was actually a loader scene.
That scene contains nothing but the loading screen and reads its target level from a dontdestroyonload management object.
If you use that, you use set the target level on the management object, loadlevel into the loading screen scene. The object in there then uses the purgeunused assets function on the application class and then loads the next level.
I’m not sure if that is still required with 1.5 though.
My scenes aren’t that heavy that I ever hit the problem so no retesting required with 1.5 yet
thanks for this hint.
I will stay with the compressed textures for now.
I don’t want to introduce some tricky loading scripts as this may go out of control.
Compressed textures are a must for anything other than GUI / pixel perfect scenarios anyway. Not only for the 75%+ memory saving you get but also for the 75%+ load time saving you get
For a 2D game I understand that (UI are commonly a case of non compression)
For 3D there is no difference actually as the filtering will bring it onto the same quality level as a 4bbp RGB texture and below anyway.
There’s a huge difference visually between 32bit and 4bbp for things that are close to the camera… However, 16bit is usually indistinguishable (and half the size…)
… Despite criticism of dremora’s comment though, once your object is into its first level of mipmapping, it turns to blurry rubbish. Of course you can still tell them apart, but that’s because we’re nerds who can pick up minute details
I’m sorry, you are naturally right.
I should have said: “the broad 90%+ majority won’t see the difference”
Guess I kind of forget those things because my girlfriend often only has left a confused shake of her head left for me when I talk about such stuff while gaming or watching computer rendered films on our TV …
20 years of constant desire to analyze and compare more or less everything …
My girlfriend is making all of the textures for our current game, so in my case, it’s more like, “Why don’t you make the rest of the game more optimized, so my textures can look prettier! I’m not dealing with blurry crap! Make some better shaders, you son of a #%$@!!!”
We play Resident Evil 5 a lot. For the first few months of having the game, we only had an SDTV. Then when I bought a 60" HDTV, the first thing she had to say was something like, “Damn it! Now I can see their polygons!”
does she have a sister like her?
like that attitude, sounds a lot like me
naw its really a personal thing how much it affects the visuals and I think the only way to get an idea if it looks good or bad are casual players or players from your target market, not devs, artists or want to be reviewers.
Nobody involved with a project can really be fully objective about it.
I’ve looked at jobs (not iphone related) I’ve done years earlier… Some I go ‘oh god, what was I thinking’ and some others I go ‘how the f#ck did I do that?’