Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

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
    }
}
 
PREVIOUS NEXT
Tagged: #detect #collision #unity
ADD COMMENT
Topic
Name
9+5 =