Search Unity

OnTriggerEnter triggering multiple times -bug? physics adjustment?

Discussion in 'Physics' started by metaphysician, Feb 15, 2021.

  1. metaphysician

    metaphysician

    Joined:
    May 29, 2012
    Posts:
    190
    hi folks, i've been working with Unity for a long time and have constantly used triggers in my games to do all kinds of things. i use the OnTriggerEnter function and it's always been reliable. but in Unity 2020.1.17 it seems that the Collider physics is overly sensitive and the trigger signal will happen twice or possibly more. this is using game projects that have worked flawlessly in the past and on scripts that literally use nothing else but OnTriggerEnter. and there aren't multiple colliders. i've tested this in at least two older projects with the same results.

    i can get around it by putting in a cooldown function, but i teach Unity audio and a trigger is literally one of the most basic lessons i can teach. cooldown coroutines are not terribly basic. but to me this should just work as it has for nearly a decade.

    has anyone noticed an overly sensitive Collider in the latest 2020 versions? if there a way to tone the physics down in the Project Settings to prevent multiple triggering from OnTriggerEnter? i'm on a macOS 10.13.6 BTW. maybe its an issue with the First Person Controller? i did have to replace it in my older UnityScript project that i upgraded to C#, but Unity 2019 had no issue with it. anyway any advice appreciated. thanks in advance!

    scott
     
  2. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,491
    There's no "sensitvity", you should get Enter->Stay->Exit. In 3D physics if you delete respective colliders/gameobject then you're likely to not get Exit. That's how it should work.

    Anything else should be reported as a bug for QA to verify and the 3D physics team to fix.
     
  3. metaphysician

    metaphysician

    Joined:
    May 29, 2012
    Posts:
    190
    no, i'm saying the multiple firing happens only on TriggerEnter. i haven't tested Exit or Stay, and i usually ignore them actually. i can file a bug report if needed, though. my triggers don't disappear like pickups for the most part.
     
  4. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,491
    Well you can get multiple enters but without you even knowing if you're getting an exit then I'm not sure how it's broken. If you're saying it's not moving or you're not modifying it and is clearly overlapping a trigger but it just pumping out Enter callbacks then that's wrong but there's no other info you've posted so hard to tell. Videos/images etc help clarify what you actually mean.