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

Question Performance on mobile (Android) with Entities 1.0 (with Physics and Graphics)

Discussion in 'Entity Component System' started by Pabi, Feb 1, 2023.

  1. Pabi

    Pabi

    Joined:
    Feb 13, 2016
    Posts:
    48
    I've built a small demo to test performance on mobile. I'm building a new game and I was wondering if I should start it with entities.

    I got a problem right now because my very small test (just some geometry falling down with physics and mesh collider) works way better in Monobehavior standard than with DOTS.

    I don't understand how it's possible... It is because we can't build in IL2CPP yet? Or because physics is bugged on android?

    I tested on an old mid-range android device to see the performance in action.

    Maybe it's just too soon yet to use this technology. Any thoughts?
     
  2. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,029
    Can u share your small test project?
     
  3. Pabi

    Pabi

    Joined:
    Feb 13, 2016
    Posts:
    48
    I'll prefer not too as there is no disclosure stuff in it. I'll have to create a new project from draft and send it. But I mean... it's very very simple. I generate 500 prefabs (with mesh, mesh collider and rigidbody).

    One scene generates them in Monobehavior and the other is generating them in entities.
     
  4. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,029
    I see. I think u can submit a bug report and put the case number at here. Anyway I'm quite curious wat's the bottleneck. Is the physics or rendering very slow?
     
  5. Pabi

    Pabi

    Joined:
    Feb 13, 2016
    Posts:
    48
    It seems to be the physics.

    upload_2023-2-1_9-57-29.png
     
  6. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    909
    You are running into a physics death spiral. Not much you can do other than optimizing the scene itself.

    Or you can manually tick physics so you don't run into frames that calculate several physic ticks, but only 1.
    This is a pretty common problem and quite hard to solve.
     
  7. Pabi

    Pabi

    Joined:
    Feb 13, 2016
    Posts:
    48
    Ok, but it doesn't answer why the same scene in monobehavior got better result on android than with entities and burst, no?

    My scene is very very sample... 1000 object dropping on a floor with collider and rigidbody. That's it.
     
  8. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    909
    Your bottleneck is physics and Unity.Physics is not the same as Nvidia PhysX. PhysX is much better optimized just for the fact that it's not stateless. It uses caching and that alone is a heavy optimization. Futhermore, you describe it as MB but PhysX is C++ engine code.

    Head over to the Unity physics subforum. I think you can get some better answers there when devs see it.
     
  9. Pabi

    Pabi

    Joined:
    Feb 13, 2016
    Posts:
    48
    Ok! Thanks Enzi. I was over the impression that the new Physics package was using burst and was faster.
     
  10. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    909
    It is using Burst but held back by the design decision of being stateless. As alternative, Unity Physics can also run with Havok which uses caching but for whatever reason Unity made the decision to hide it behind Unity Pro. So it's sadly not a real alternative for us indie devs. We can't even use it for development which is a damn shame. (I just tested and get NotSupportedException: Simulation type HavokPhysics not supported! in the latest Unity.Physics version.)
     
  11. Pabi

    Pabi

    Joined:
    Feb 13, 2016
    Posts:
    48
    Can we make the assumption that in a near future, Physics under BURST is going to be faster? and/or Havok is going to be supported under dots?
     
  12. inSight01

    inSight01

    Joined:
    Apr 18, 2017
    Posts:
    87
    Probably not. It'll be close though. Close enough to not really care about the differences in the majority of applications you're bound to use it for.