Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Feature Request Option for Disabling/Destroying objects in colliders activate exit events

Discussion in 'Physics' started by TheCelt, Nov 2, 2022.

  1. TheCelt

    TheCelt

    Joined:
    Feb 27, 2013
    Posts:
    741
    Hi

    I would like to request the feature that if a collider is inside a trigger/collider and you destroy or disable it, there should be an option to allow us to still cause it to activate the exit events.

    I have this situation where I have OnTriggerEnter, and some times the RBs that enter this trigger are destroyed. But this does not activate OnTriggerExit which means I have to manually call some kind've removal which means making public functions that request removal, and I would rather not have to do this.

    It would be nice to have the option that Destroyed/Disabled object will activate the exit events OnCollisionExit and OnTriggerExit.

    I'm fine with it not being the default behaviour, but at least having the option would be nice.
     
  2. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,082
    For 2D physics this already happens as controlled by this. You may get this if you destroy (not disable) the object explicitly however note that depending on how and where it's destroyed, because Unity cannot perform callbacks during certain actions such as the scene being unloaded etc, it might not happen.

    I don't believe this happens in 3D though if you're talking about that.
     
  3. TheCelt

    TheCelt

    Joined:
    Feb 27, 2013
    Posts:
    741
    Yeah I am using 3D at the moment. It doesn't happen for 3D which is a pain and would be nice if the feature could be available to us. Or is it not possible ?
     
  4. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,082
    I guess it could be implemented in a similar way to 2D however I am simply being the messenger here, I am not in charge of such work.
     
  5. TheCelt

    TheCelt

    Joined:
    Feb 27, 2013
    Posts:
    741
    How do we request it so those in charge can see the suggestion ? Otherwise its a bit pointless having the feature request tag in the forums.
     
  6. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,082
    Honestly, I have no idea. Some teams look at the forums, some don't. I think this has been suggested previously, I guess it's not a high priority. In the end, it's up to the teams involved in such features.