how to detect collision in unity

[ad_1]

how to detect collision in unity
void OnCollisionEnter(Collision collision)
{
	if(collision.gameObject.tag == "yourNameOfObject")
    {
    	//This is example
        Debug.Log("Hit Object");
        //code your thing here
    }
}

[ad_2]

Please follow and like us:
Content Protection by DMCA.com