Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

OnTriggerExit not hitting when trigger collider is disabled?

Discussion in 'Physics' started by benthroop, Oct 27, 2021.

  1. benthroop

    benthroop

    Joined:
    Jan 5, 2007
    Posts:
    262
    To repro:
    Make a sphere collider trigger.
    Put some colliders inside.
    Disable the sphere collider trigger.
    OnTriggerExit does not get called on the sphere collider trigger GameObject.

    Is this expected behavior?

    My workaround is to set the radius of the SphereCollider that is serving as the trigger to 0. This causes OnTriggerExit to hit. Conversely, setting the radius back to its original non-zero value causes OnTriggerEnter to hit for each overlapping collider.
     
    ElasticSea likes this.