unity oncollisionenter and codition code example
Example: unity oncollisionenter
void OnCollisionEnter(Collision col)
{
//This method will run when your game object
//collides with something
Debug.Log("Collided");
}
void OnCollisionEnter(Collision col)
{
//This method will run when your game object
//collides with something
Debug.Log("Collided");
}