unity on collision with player tag code example
Example 1: how to do collision tag in unity
void OnColliSionEnter2D(Collision col){
if (col.gameobject.tag == "Enemy"){
Destroy(gameObject)
}
}
Example 2: unity check tag
gameObject.tag