Answers for "how to detect collisions in unity"

C#
3

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
    }
}
Posted by: Guest on August-03-2021
13

check for collision unity c#

void OnCollisionEnter(Collision col) { }
Posted by: Guest on April-09-2020
5

how to do collision tag in unity

void OnColliSionEnter2D(Collision col){
   if (col.gameobject.tag == "Enemy"){
        Destroy(gameObject)
        }
}
Posted by: Guest on May-14-2020

Code answers related to "how to detect collisions in unity"

C# Answers by Framework

Browse Popular Code Answers by Language