Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Insane amount of drawcalls on simple mobile title

Discussion in '2D' started by Juicy, Feb 7, 2016.

  1. Juicy

    Juicy

    Joined:
    Dec 21, 2012
    Posts:
    12
    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 :)
     
  2. Teravisor

    Teravisor

    Joined:
    Dec 29, 2014
    Posts:
    654
    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).
     
  3. Juicy

    Juicy

    Joined:
    Dec 21, 2012
    Posts:
    12
    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

    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
     
  4. Teravisor

    Teravisor

    Joined:
    Dec 29, 2014
    Posts:
    654
    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)
     
  5. Juicy

    Juicy

    Joined:
    Dec 21, 2012
    Posts:
    12
    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?
     
  6. Teravisor

    Teravisor

    Joined:
    Dec 29, 2014
    Posts:
    654
    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.
     
    Juicy likes this.
  7. Juicy

    Juicy

    Joined:
    Dec 21, 2012
    Posts:
    12
    Thank you very much for your insights, I've contacted the developer and hope for a solution :) Do you know if there is any way to debug from mobile so I could check the amount of physics GameObbject?
     
  8. Teravisor

    Teravisor

    Joined:
    Dec 29, 2014
    Posts:
    654
  9. Juicy

    Juicy

    Joined:
    Dec 21, 2012
    Posts:
    12
    Got an idea how to tackle it now, thank you!