how to detect collision using oncollisionenter code example
Example 1: check for collision unity c#
void OnCollisionEnter(Collision col) { }
Example 2: how to do collision tag in unity
void OnColliSionEnter2D(Collision col){
if (col.gameobject.tag == "Enemy"){
Destroy(gameObject)
}
}