destroy player on collision unity code example
Example 1: destroy gameobject unity
Destroy(this.gameObject);
Example 2: unity destroy object on collision
void OnCollisionEnter2D(Collision2D coll)
}
// Check if we have collided with the enemy
if (coll.gameObject.tag == "Enemy")
{
Destroy(coll.gameObject);
}
}