Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

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:
    746
    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,761
    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:
    746
    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,761
    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:
    746
    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,761
    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.