Search Unity

Physics in Profiler -- what goes into it? (Huge increase with each enemy)

Discussion in 'Physics' started by infinitypbr, Mar 22, 2015.

  1. infinitypbr

    infinitypbr

    Joined:
    Nov 28, 2012
    Posts:
    3,149
    Hello,

    I've got my profiler going and each time an enemy is activated the physics.simulate increases. (It can fill the profiler window even!)

    I have a few physics commands in the enemy script, but they're only called once or twice a second, not every frame.

    I'm trying to figure out what I may be able to do to limit the impact that physics has on the game, but without any more details than what the window in the image shows, I'm kind of at a loss. Is there anything else besides the physics calls that goes into this? Should it be this high?

    This one frame, btw, has a giant spike in physics, and i have no idea why.

    THANKS!!!

    Screen Shot 2015-03-21 at 9.05.43 PM.png
     
  2. Todd-Wasson

    Todd-Wasson

    Joined:
    Aug 7, 2014
    Posts:
    1,079
    Probably about all you can do is change the time step to something greater so the physics aren't being computed as often.
     
  3. Brainswitch

    Brainswitch

    Joined:
    Apr 24, 2013
    Posts:
    270
    What colliders are you using on your enemies? When you activate an enemy the colliders need to be eh... baked into the physics engine - might be why you see a spike.
    Have you tried deep profiling?