Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm running into a situation where my frame rate drops from 70 FPS (on my desktop computer) down to 5 FPS (on my iphone) and I'm trying to understand why. At the moment, I'm only drawing simple tiles, with box colliders attached to them, on the screen...

enter image description here

I've read that colliders are very expensive to have and I have 2400 of them on the screen at any given time. My questions are...

  1. Do you think it's the number of colliders that are causing the slowdown?
  2. If so, what are some ways I can optimize this?
  3. If not, what do you think the problem is?

Thanks so much for your wisdom!

Also, it's worth noting that I'm using 2D Toolkit in Unity for drawing.

UPDATE: I just removed all the colliders in the scene and I'm still experiencing the slowdown. Your thoughts?

share|improve this question
1. yes, 2. don't have so many colliders, Are you trying to achieve something in particular? Also note not a good measurement between desktop and phone (different systems), if you wish to benchmark start of with no colliders and add more till 2400 to compare the equiv speed differences. – AbstractChaos Aug 8 '12 at 17:24
ok, so it's actually not the colliders. I just removed all the colliders and the i'm still experiencing the slowdown. Your thoughts? – BeachRunnerJoe Aug 8 '12 at 18:00
Removing the colliders will make performance worse right? I mean your intent is to optimize collision...or what? Have you considered checking the settings for your iphone project? – Sidar Aug 8 '12 at 19:19
When exactly do you experience the slowdown, please describe your setup. – jonas Aug 9 '12 at 7:56

Any time slowdown is an issue, the important thing to do is test and measure. There are a variety of tools available to do so, but even without a profiler you can do this simply by measuring the time different sections take via things like System.Diagnostics.Stopwatch (if using C#) or even the base unity Time information.

You've already determined the colliders, while very numerous, don't seem to be the cause of the performance drop between systems so see if you can rule out other large sections of your code, either by timing or by simply commenting them out and testing framerate again. Chances are you'll find a big chunk somewhere that suddenly brings the framerate up when you leave it out and you can then repeat the process inside that chunk until you've found the offending section.

share|improve this answer
good tips, thank you! – BeachRunnerJoe Aug 8 '12 at 18:49

I'm new to this, but it would seem to me that if things aren't working, you should try something else. So maybe try a fewer colliders?

EDIT: You also might try using a fixed frame rate, like described here: Maybe you can fix the framerate so it stays high

EDIT2: Maybe you have a memory leak? This article talks about that possibility on iOS:

share|improve this answer
Good answers get upvotes. Not answers that ask for upvotes. This doesn't address the original question very well and it doesn't address the updated question at all (which was updated before you answered) – Byte56 Aug 8 '12 at 18:17
oh, thanks for the info - I'm pretty new to this, I'll try to do a better answer with my next one – Bob Flanderson Aug 8 '12 at 18:18
Bob, you can edit this answer to improve it, no need to wait until the next one. Additionally, you're free to ask a question before getting 10 points. You'll just have to make it simple without all the images and links you want. If it's a good question it'll get upvoted and you'll have enough rep to update it with images and links. – Byte56 Aug 8 '12 at 18:20
Oh, ok - I've been trying to help people out with their questions by trying to find good resources for them online. Thanks for the tip! – Bob Flanderson Aug 8 '12 at 18:29

I think Unity uses Box2d? IIRC from an old read box2d uses some sort of spatial trees so that inactive colliders should not consume much CPU power.

My guess is, check your draw calls which are very often the cause for lags on mobile, make the colliders invisible and see if it helps in your frame rate, good luck.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.