GameObject not destroying on Collision
Hello, I am trying to collide my Player object so that it can hit and destroy the enemy but , problem is it wont collide, i dont know where is the problem since i am new Code is Below rest everything in unity is at default. Please Help Thank You.
ITS A 2D GAME
HERE
void OnCollisionEnter2D(Collision2D col){ if (col.gameObject.name == ("portal")) { Destroy (col.gameObject); } }
Answer by exzizt · Mar 24, 2018 at 04:34 AM
Take a gander at this: https://docs.unity3d.com/Manual/LayerBasedCollision.html
Your answer
Follow this Question
Related Questions
Player falls through destroy collider 1 Answer
Why won't this object destroy on collision? 1 Answer
Pass nothing inside OnTriggerEnter2D(Collider2D other) 0 Answers
Making objects with the same tag destroy eachother 1 Answer
Ignore certian overlapping Colliders OR Specify collision object for Destroy 0 Answers