Answers for "how to detect collision in unity 2d"

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
2

unity 2d collision

void OnCollisionEnter2D(Collision2D col) {
  Debug.Log("Collided with: " + col.gameObject.name);
}
Posted by: Guest on October-14-2020
0

oncollisionenter2d

OnCollisionEnter2D(Collision2D Collider)
Posted by: Guest on September-03-2020

Code answers related to "how to detect collision in unity 2d"

C# Answers by Framework

Browse Popular Code Answers by Language