Insane amount of drawcalls on simple mobile title

I am currently working on my first serious title as a hobbyist and have encountered a problem. When building for mobile physics suddenly take a huge amount of drawcalls and makes the game neigh impossible to play.


(the spikes are caused after level restart with a SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex) )

Compared to the game running on pc the physics takes up a very small part of the process.


Any idea what could be causing this? Feel free to ask away all you can think of it’ll be deeply appreciated :slight_smile:

Does it have a lot of static objects? Once I’ve encountered issue of them not properly static batching when loading scene (I used additive loading though).

Tahnk you for your answer. No the scene in question is very simple containing only a single rigidbody and very basic colliders

I think it has something to do with the terrain that is made with ferr2d, though it is also very low-def very low-def

The thing I don’t understand logically is why the profiler looks so different on mobile and pc platform and that basic physics takes up such a disproportionate amount of calculations

It’s general performance(what you see as 0.5% on PC can be 2% on mobile) and architecture(1 CPU instruction on PC can be 5 on mobile) differences. So they tend to stack up.

Hmmm… Maybe ferr2d creates too much colliders if scene reloads? Like instead of creating only one collider it doubles, triples them, doesn’t merge when needed, etc… Can you check if it’s terrain that’s causing it or not? (Replace it with one box collider just for testing for example)

I did that and it did indeed fix the problem, but I basically need the plugin for my gameplay to work.

But the drawcalls on mobile are not merely mulitplied a few times but is increased ~200 times. That seems ridiculous to me, there is not some known setting or bug that destroys mobile physics?

Those are not DrawCalls. Those are Physics.Simulation/Physics.Processing/Physics.FixedUpdate calls. They are passed to each GameObject. So your scene magically gets a ton lot of GameObjects that it shouldn’t have. And as it doesn’t happen without terrain, it’s ferr2d issue.
Maybe it creates each triangle as separate gameobject in some specific case or some other bug happens. I’ll leave this topic as issue is within ferr2d and as I don’t have ferr2d I can’t help much.

1 Like

Thank you very much for your insights, I’ve contacted the developer and hope for a solution :slight_smile: Do you know if there is any way to debug from mobile so I could check the amount of physics GameObbject?

I suggest reading manual and topics on that(pick what you like or google for more):
http://docs.unity3d.com/Manual/AttachingMonoDevelopDebuggerToAnAndroidDevice.html
http://forum.unity3d.com/threads/attaching-monodevelop-debugger-to-an-android-device.245814/
http://sebastien.lebreton.free.fr/blog/index.php?/archives/53-Debugging-an-Unity-Game-under-Android-using-Visual-Studio-and-UnityVS.html

Got an idea how to tackle it now, thank you!