OnCollisionEnter not called when collider is enabled and already inside another collider
Hello, I have a collider and a rigidbody on Object A. I want to register OnCollisionEnter on Object B, which too has a collider. This works fine, until I enable the collider component of Object A while it is inside of the collider of Object B. In that case OnCollisionEnter doesnt fire inside Object B.
This is highly problematic for my use case, since I can't let Object B check for OnCollisionStay (which would be a workaround), since I have thousands of Object B in my scene and this introduces massive overhead.
I have to enable/disable the collider on Object A, so preventing this problem by not enabling/disabling is not an option.
Any ideas how I can trigger the event on collider component activation?
Answer by Fressbrett · Jun 16, 2020 at 09:29 PM
For anyone interested, I found the answer. Enable it, then disable it, then enable it.
https://answers.unity.com/questions/213599/ontriggerenter-not-firing-if-i-instantiate-a-gameo.html
Your answer
Follow this Question
Related Questions
Player/platform collision not detected 1 Answer
Collisions in Editor Test Runner 0 Answers
OnCollisionEnter with two kinematic Rigidbodies? 1 Answer