I have a question for you all, We are testing an iPhone game that uses Unity 3D component. The game takes a long time to load (the size of the game is 37 KB). I was wondering if any one of you can recommend some performance improvement tips that I can pass on to developers?
My other question is what would be the best way to log the crashes. The game crashes randomly and I was wondering if there a logging mechanism that can be used.
You can see crash info in the Xcode console. Common reason would be too high memory use , or null referenced variables. Also try restarting device to free up memory.
To speed up loading you can add an empty or light weight level that then opens the 2nd level.
With advanced you can also use build stripping.
37kb gamesize is pretty much impossible. that would mean that you have no single texture in.
Procedurally generating them by the way wouldn’t be the smartest idea (actually the opposite), as using PVRTC isn’t really “optional” if you want highest possible performance. And procedural → no pvrtc
I’m sure that was supposed to be 37 MB. That’s fairly substantial for an iPhone game, and if you’re loading all that as one scene, you’re on the edge of taking up too much RAM (hence the random crashes). Reduce the size as much as you can, which will help loading speed and crashing.
My latest one is 22 MB, one scene and uses asset cloning, I have a total of 9 objects textured, 1 background image compressed etc. If I look at my asset folder information, there are a total of 6.8 megs in my assets folder along with 60k in my scripts folder. So basically, I have ~15 megs of Unity overhead in my project once compiled into binary. This is pretty lean and mean really.
To reduce the time to load the game I suggest you add a small ‘splash’ scene as the first loaded scene. Just include your game logo and then jump to the main (bigger) game scene.
even we are facing the same problem to reduce the initial loading time which is approx 10 sec on our device 20 - 30 sec on our clients device i have added a simply a splash screen showing animated progress bar which is containing only 2 GUITexture 1 Script File to do the progress bar animation than call next level after 1.0 sec. but yet there seems to be no change in the loading time. even our application is of 37MB approx.
Strange, I’m using an iPod Touch 1st generation for dev normally, the by far slowest device and do not have such problems.
Sounds like they commonly forget to restart the device every now and then.
You can run about 10 - 15 distinct applications normally until you require a restart due to iPhones borked memory handling in its sandbox
If you have iPhone Advanced you can set the iPhone stripping Level to ‘Strip ByteCode’ (find it under ’ Edit / Project Settings / Player’ settings in the menu)
Please don’t think I’m being funny with you here but you haven’t really given us enough to think about here I’m afraid, perhaps you could be more specific about what you are actually loading in your 37MB?
Have you broken your app/game into smaller scenes?How are your textures set up - are they square? Have you compressed them? How big are they? How many meshes and how many polys are the meshes? Are you using lots of sound? Have you any animated characters? How many characters? polys?bones?
Maybe with some more information we can help more? This community is excellent at helping I have found, so give us more to go on.
The applications is divided in total 6 .Unity file which are stated below:
1> Loading Screen (Showing animated Loading progress bar containing 2 imgs 512256 6432 1 Script file )
2> Game Menu (Show Help Imgs start Game Option 10 imgs of 512512, 2 GUI Buttons, 7 audio 1 Script file )
3> Level 1 Have approx 150 Phy Objs( plane of 2 triangles using Box Collider), +30 Non Phy Objects + 2Gui Buttons, 7 audio 1 Script file
4> Level 2 Have approx 130 Phy Objs( plane of 2 triangles using Box Collider), +30 Non Phy Objects + 2 Gui Buttons, 7 audio 1 Script file
5> Level 3 Have approx 130 Phy Objs( plane of 2 triangles using Box Collider), +30 Non Phy Objects + 2 Gui Buttons,7 audio 1 Script file
6> HighScore Display screen ( 8 GUI text 1 img 512512 2 Gui Buttons 1 Script file)
There are total 6 script file of combine size 60KB
total 40 images of size 3 Mb approx max of 512 * 512 ( 12 img), 512256 ( 7 img ), rest all are small 256 256,64*32,etc…
14 audio files of 2.1 MB
10 Obj mesh out of which 8 are plane with 2 triangles another 2 mesh having total 100 triangles approx so total 116 triangles approx
3 Font Files.
Even the Text which is displayed for showing score details on the screen is created using 2 diff prefabs
All the Objects are nothing but 7 diff prefabs which are placed in the 3d world according to the requirement.
Ok, well if it is loading we are discussing the first thing I would do is build a test rig to see what effect each section has on the actual loading time.
I would probably remove everything beyond the loader, menu and level one. I would try to build that - check it on the iPhone in terms of loading and playing. (How does it play by the way? 150 physics objects does seem like a load for the iPhone but who knows?)
It seems like you are using virtually every main library Unity has so maybe thats what is holding the game up start wise - you may not be able to get around that as stripping only removes stuff you are not using as far as I know.
You didnt say if the textures were compressed or not? What are you settings for them? You’ll save a load by using the PRVT compression which is built into iPhone and from what I understand from other users, that will help will speed of deployment too.
yes all the texture are compressed if i try anymore compression over it the quality get reduce significantly we can c the texture as blur. in fact i reduce the img dimensions as low as possible for the application. all of my texture are of PRVT compresion 2/4 rgb / rgba depending on the requirement.
there is nothing which can be called extra now wht ever objs/images are present are the require most frequently used once
Well, it looks like you have everything in place for a super efficient app, so maybe you are pushing the iPhone to the edge of its limits?
How long does it take to load?
Have you tried it on an iPod Touch (2nd generation)?
Did you try building a smaller - single level version and see how long that takes to load? I would be interested to know if a single level version was much quicker to load than the full version, as I believe its the Unity libraries you are using which you are having to load and then all you media too.