unity how to detect when something collides with an object 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)
}
}