- Home /
My iPhone game is choppy - how can I improve the framerate?
My game is choppy (below 20 fps) with <30 draw calls and <4.4K tris.
Is this gameObjects count fault ?
Too many game Objects ?
How many gameObject can an iphone3G / ipod2G have ? 1000 ?
I'm using now for my level 120 pieces (Mesh) with 4-24 box colliders each. That will be many thousand (around 3000-4000) gameobject in the scene, and in fact, even if stats tell me that polycount is 4.4K and draw calls are 19, my framerate dropped from 29 to 19 FPS.
Why ?
Answer by $$anonymous$$ · Nov 20, 2009 at 07:46 AM
Turn on the profiler (the instructions are in the Unity iPhone Manual, under Optimization, I think), and see how much of your frame time is spent in rendering, physics, script, etc, then you'll have a better idea what to investigate.
Answer by Kiyaku · Nov 20, 2009 at 05:36 AM
Switch from "Safe and Slow" to "Fast and no exception", maybe that helps :D
Don't know how many objects the iPhone can handle, but it somehow sounds too much to me but i don't know.. i rarely have more than 20-30 objects and 10-20 drawcalls.
Answer by TowerOfBricks · Nov 20, 2009 at 06:57 AM
It can also be some scripts which rum slow, although 3000 objects sounds like suite a lot, try deactivating some scripts and see if it helps.
Answer by Litobyte Softworks · Nov 20, 2009 at 09:10 AM
Ok, I'll profile more deeply.
I have already "Fast and no exception" in the player settings And I have only 4 / 5 optimized scripts for running the whole game.
You mean try to disable the gameobjects by script? Because I don't feel to disable any of the 5 scripts I use for the game :P
That's the problem! :)
cpu-player> $$anonymous$$: 32.6 max: 73.9 avg: 40.7 cpu-ogles-drv> $$anonymous$$: 2.3 max: 26.0 avg: 3.6 cpu-present> $$anonymous$$: 0.5 max: 3.3 avg: 1.1 frametime> $$anonymous$$: 40.5 max: 104.8 avg: 48.9 draw-call #> $$anonymous$$: 25 max: 25 avg: 25 | batched: 0 tris #> $$anonymous$$: 3994 max: 3994 avg: 3994 | batched: 0 verts #> $$anonymous$$: 2325 max: 2325 avg: 2325 | batched: 0 player-detail> physx: 31.1 animation: 0.0 culling 0.3 skinning: 0.0 batching: 0.0 render: 6.9 fixed-update-count: 2 .. 5
mono-scripts> update: 0.8 fixedUpdate: 0.3 coroutines: 0.0 mono-memory> used heap: 258048 allocated heap: 356352 max number of collections: 0 collection total duration: 0.0
Answer by Litobyte Softworks · Nov 21, 2009 at 02:55 PM
i rarely have more than 20-30 objects
By the way, I shot 3000, but we are around 1200 objects ( I actually almost counted them ). Problem is that we can't put 10 colliders on a single gameObject in Unity, you need 10 gameObjects !
And of course I'm talking about an iPod 8 gb and an iPhone3G stats, not the newer 3Gs and ipod32gb.
I achived this high number of objects because I have multiple box colliders as children of my mesh object, some of this have up to 30 box colliders as children, I still don't understand how you can state you games only have 20-30 objects, maybe you are doing FPS so you use occlusion culling, but on my project this is not possible as it is not an FPS, or third person.
Do you suggest a Custom Script which disables all static level meshes/pieces/gameObjects which are not-in-view and check this every single frame ? Won't this script be a cpu-killer ?
What Am I missing ? Perhaps there is a way to combine 10 box colliders in one object ?
You can have more than 1 collider per game object, I did not try 10 but I have 4 on my cars.
Your answer
Follow this Question
Related Questions
Can I stop a lerp completely when it gets to 20% of its original value? 3 Answers
How to do iPhone Optimization with materials, textures and callbacks? 1 Answer
iPhone Optimization - using 1024x1024 textures for background 0 Answers
do static variables slow down framerates in iphone 2 Answers
Game crashing on iOS after 3 second load of new scene. (How can I optimise loading) 0 Answers