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 testing Unity for a game that I'm building, and I've touched its limit.

My test scenario: a wanna-be house with 200 elements (cubes rescaled) no textures, box colliders and rigid bodies for each "cube" and fixed joints to hold them together (400+ fixed joints). The house is on a plane, and above it I put 2 sphere at different altitudes, spheres which will crash in the poor house.

This moves very slow on an iPod Touch 3rd generation. Therefore I'm looking for some documentation to create a reasonable budget for the number of polygons, physics collisions and so on. What is your recommendation?

share|improve this question

closed as too broad by BlueRaja - Danny Pflughoeft, Anko, Sean Middleditch, Byte56 Feb 4 '14 at 15:18

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.If this question can be reworded to fit the rules in the help center, please edit the question.

Do you have any code in the update functions for the cubes? Also the poly count should be fine since it's only about 2400. I know with physics I try to stay under 10k polys as per the documentations recommendations, but I'm too lazy to answer this completely since I'de have to test build on my ipod. – brandon May 23 '11 at 13:39
I have no code into my update function, not for the the above test. 10k polys is smth to remember, thanks :D – Andrei T. Ursan May 23 '11 at 13:58
My suggestion as it's what anyone would have to do to answer this: get the pro trial. Open up the profiler and first do the wall without the joints. Look at the percentage of CPU that physics is using. Then enable the joins and look at the percentage again. Also watch the framerate. You can find your limits there. – brandon May 23 '11 at 14:07
up vote 4 down vote accepted

I would have posted a comment but I don't have enough Rep. to :(. Having working with Unity3D on PC we came into problems with the phsics engine when there were too many fixed joints; suprisingly there are very greedy, I'd guess even more-so on iOS as the Physics is CPU dependant.

The guidelines for Unity are generally quite good, you could check out this link for optimizing performance in iOS.

They obviously tell you to use the Profiler, which I also recommend, if you can't go Pro, you'll just have to keep on testing :/.

Oh and as you are using fixed joints to attach the walls, you could maybe use capsule colliders with high friction to simulate the bricks and change this at real time with a box collider once the brick is not longer attatched to any others. (Any two bricks attached should still have a decent simulation even with capsule colliders.)

share|improve this answer
agreed. u might also want to try to run perfmon.exe on windows providing you don't have dedicated physics processing. – brandon May 27 '11 at 14:22

My recommendation is to utilize a profiler or some other form of metrics gathering, that way the physics budget you arrive at will be tuned for your specific game -- the numbers others provide for their games may not apply so well for your game. This is especially true in general, but it tends to hold even if you're using common technology like Unity.

Xcode ships with Sampler and Shark, which can be used to profile applications (although maybe not Unity ones, at least not usefully). You may be able to inject home-grown profiling/timing gathering solutions into your code as well, provided you have any.

Failing that, I'd take a divide-and-conquer approach. You say your initially-described scenario runs poorly, so I'd start with that and halve one of the numbers (either the number of cubes, the number of joints, et cetera), and see how that performs. Try to change only one variable at a time. It's pretty ad hoc, but it might be what you need to do if you can't get the pro trial that comes with the Unity profiler.

share|improve this answer

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