how to detect collision between gameobject and collider in unity 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)
}
}