Search Unity

Physics.Processing huge, random spikes

Discussion in 'Editor & General Support' started by AllanSmithZ3, Aug 6, 2019.

  1. AllanSmithZ3

    AllanSmithZ3

    Joined:
    May 21, 2019
    Posts:
    23
    Hey,

    So, Im developing a game that does not use physics for anything, BUT, stuff have colliders for input purposes (mouse clicks). They basically dont move, except when I get them from the pool and position them in the right position... I mean, I expect the physics simulation in this game to be none... but... this is what I've been getting on iOS devices (and in a smaller proportion on the editor as well), huge spikes of like 40 seconds frames stuck just on that, as shown in the

    This is happening in Unity 2019.1.5, and in random intervals... this seems like either some kind of Unity bug or I am somehow doing something very wrong... though to be honest, I wouldnt know what, to be honest I use Unity mostly as the "view" only... so idk, anyone has had this problem before? Should I just attach rigidbodies for everything even though I dont need rigidbodies?

    I saw some other posts about this problem in older versions of Unity, from 5.6, to 2018.x, but havent seen anyone mentioning it for 2019 and no solutions proposed either... so any clue would be helpful!

    Thanks for the attention,
    Best,
    Allan
     

    Attached Files:

    LuisAlarconGames and PKras like this.
  2. AllanSmithZ3

    AllanSmithZ3

    Joined:
    May 21, 2019
    Posts:
    23
    yassineelakkazi likes this.
  3. AllanSmithZ3

    AllanSmithZ3

    Joined:
    May 21, 2019
    Posts:
    23
    In the end I've noticed you can disable "Auto Simulation" of the physics in the Physics options, which is super cool by the way, so done that and apparently am no longer getting those spikes (and even got a tiny bit of performance out of that), but, I guess the question still stands, seems like something that could happen to others.
     
  4. AllanSmithZ3

    AllanSmithZ3

    Joined:
    May 21, 2019
    Posts:
    23
    I ended up turning "Auto Simulation" on again cause I didnt want to check for the clicks myself in world objects, which is a bit annoying, and the freezes continue... Updated Unity to 2019.2.0.f1 in the hopes that there might be something there but unfortunately, still getting them. I have literally nothing going on, just buildings (static most of the time) with colliders to receive IPointerClick events, and when they are clicked, they move a bit and then get sent back to the pool and disabled... all of them dont even have rigidbodies, just colliders... so not sure, any ideas of what might be causing those large freezes? Cause as soon as I turn "Auto Simulation" off, the game stops freezing (btw I am testing leaving the bots playing my game, which means I dont need to click, so even without clicking I get huge freezes)
     
  5. AllanSmithZ3

    AllanSmithZ3

    Joined:
    May 21, 2019
    Posts:
    23
    Okay so just an update in case someone is interested, I tried adding rigidbodies, making them kinematic, all that stuff... with no luck. Im using 3d assets for now but the game is essentially 2D, so I went on and changed all colliders to be 2d colliders, removed "Auto Simulate" for 3d physics, enabled it for 2d physics, and, apparently, that solved the issue. When I mean "solved" I mean "dodged", and I would feel really bad if you run into this and is not able to use 2D physics for your game (hell, I dont even use physics for anything other than input).

    Also, the issue only seems to happen on iOS, I wasnt able to reproduce it in Android or the editor.