- Home /
OnTriggerExit2D works not always
I have a small 2D platformer like game. In that game you play as a cube, and jumps between platforms. After I added moving platforms, I saw that my cube sharply move down, when platform move down. So, I just make a trigger, that a bit larger than cube and when OnTriggerEnter2D method called, I add cube as a children of the platform. And I want to set cube parent as null, when OnTriggerExit2D method called. But OnTriggerExit2D works not always. Sometimes (more frequently when platform move down) when player jumps, player still count as a child of the platform. I can increase chances of successful "unparenting" by increasing size of a trigger, and additional call player.parent = null in Jump() method, but that not works 100% for me.
Platforms collision detection == discrete, and player == continuous. Thanks for your attention! )
Answer by HummeL_YT · Aug 15, 2021 at 09:09 AM
If I remember correctly, then there is another way to do bump, but...
Bump
Your answer
![](https://koobas.hobune.stream/wayback/20220613041536im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
2D Triggers and Collisions not working as expected. 2 Answers
Get callback when trigger enabled inside other collider 2 Answers
OnTriggerExit doesn't fire when changing RigidBody (bug? feature?) 2 Answers
Bouncing the ball off a collider and destroying it using trigger 0 Answers
How do I make a bridge in game over an existing collision? 0 Answers