void OnCollisionEnter2D(Collision2D coll)
}
// Check if we have collided with the enemy
if (coll.gameObject.tag == "Enemy")
{
Destroy(coll.gameObject);
}
}
void OnCollisionEnter2D(Collision2D collision)
{
Destroy(gameOnject);
}
// Or if you only want it to be destroyed when
// hitting something specific
void OnCollisionEnter2D(Collision2D collision)
{
if(collision.gameObject.tag == "tag")
{
Destroy(gameObject);
}
}