I am currently working on a 2D game and have patrolling NPC’s that should kill the player when the player collides with them and they do not and the debug does not appear. The player can collide with the NPC’s but does not die. The code looks like this and has been put on the NPC. What have I done wrong?
#pragma strict
function Collision2D(coll : Collider2D){
if(coll.gameObject.tag == "Player" )
{
Destroy(coll.gameObject);
}
Debug.Log("Get rekt");
}