oncollisionenter code example
Example 1: unity oncollisionenter
void OnCollisionEnter(Collision col)
{
//This method will run when your game object
//collides with something
Debug.Log("Collided");
}
Example 2: oncollisionenter
void OnCollisionEnter(Collision collision)//Make sure to put this out of Voids
{
if (other.gameObject.tag == "Object")
{
Debug.Log ("Collided");
}
}