- Home /
My player is unexplainably destroyed when collides with a collider
My player is a simple 2D sprite with just a Rigidbody2D component attached to it. In the scene I have other scene objects with Rigidbody2D and BoxCollider2D components. None has its isTrigger set to true;
Consequently, everytime my player object finds itself in the area of the scene objects' colliders, it is automatically destroyed. I do not have a function implemented for this, so I am a bit puzzled by this problem.
Has it something to do with the physics in the newest version of Unity?
Assu$$anonymous$$g the latest version of Unity 2D physics is deleting objects is strange; physics has nothing whatsoever to do with GameObject lifetime. Have you tried temporarily removing everything else from your project to ensure nothing is indeed deleting your object. Unity will not automatically destroy an object without you first asking for it to be deleted via the scripts. Are you sure the player is being destroyed and not moved out of the view? Also, if your player doesn't have a collider, it won't collide with anything anyway so it won't be related to physics. This isn't a great answer I know but questions like this are probably more suited to the forums with some example script (if possible).Has it something to do with the physics in the newest version of Unity?
99.99999% not a problem with Physics. So your player has nothing but a SpriteRenderer and Rigidbody2D components? (no colliders? no movement scripts?) How does it move to collide with other scene objects then?
Your answer
Follow this Question
Related Questions
2D Physics Problem? 1 Answer
How would I prevent ghost vertices? 2 Answers
Why collision2d happend earlier in rigidboy2d? 2 Answers
2D Box Colliders Overlapping On Collision 4 Answers
What's a good way at keeping a ball bounce around inside the scene? 1 Answer