Question by
qlife1146 · May 21, 2017 at 05:11 AM ·
collision2ddestroy object
PlayerObject will be destroyed even if it does not touch the enemy.
When I first coding destroy, Player object is wiggled when it touches the enemy.
but, when I fixed the problem, I had another problem.
The gameObject will be destroyed even if it does not touch the enemy.
Press play and disappear after 1 second. Player object did not touch the enemy.
void OnCollisionEnter2D(Collision2D coll) {
if (coll.gameObject.tag == "EnemyCar")
Destroy (gameObject);
}
it is very simple and very short. but, i did not find problem.
plz check my problem.
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612122459im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
2D sprite won't destroy on collision 0 Answers
Respawn not working past 2nd respawn 1 Answer
How to fix MissingReferenceException? 0 Answers
How to destroy the most ancient clone? 0 Answers
Who collided first 0 Answers