Search Unity

Physics breakdown in Profiler

Discussion in 'Physics' started by roger0, Aug 25, 2015.

  1. roger0

    roger0

    Joined:
    Feb 3, 2012
    Posts:
    1,208
    The major bottleneck for my game is physics. When I look at the profiler, physics is taking up between 40 and 50 percent of the CPU. However, it wont provide a breakdown of what specific components are causing the issue. Is there any way to tell? Thanks.
     
  2. JamesLeeNZ

    JamesLeeNZ

    Joined:
    Nov 15, 2011
    Posts:
    5,616
    Its not un-usual for physics to be taking a big chunk of CPU. Its definitely a bugger that you cant dig into too deeply.

    No way around it that im aware of. One small suggesting for performance gains is make use of the physics layers.
     
  3. roger0

    roger0

    Joined:
    Feb 3, 2012
    Posts:
    1,208
    Looks like I fixed the problem by eliminating some large rigidbody triggers in the scene. I still wish there was a way to find out what objects are causing the physics lag though.
     
  4. StarvingIndieDeveloper

    StarvingIndieDeveloper

    Joined:
    Aug 21, 2015
    Posts:
    274
    Well, one method would be to remove the objects one by one (depending on how many objects you have). I would guess the main problem is either: 1) large airships with lots of components; 2) lots of machine gun fire in the larger battles if each bullet has a script and collision detection. Raycasts are especially problematic because the raycast function is slow.
     
    roger0 likes this.
  5. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Percentage is the most useless statistic on the profiler. For example if I render a single triangle, it will have a large percentage. Why? because it's in relation to doing absolutely stuff all else.

    Instead, rely on Time ms.