Answers for "how to detect collision of some other gameobject 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
5

unity how to do collision detection with one object

void OnCollisionEnter(Collision collision)
  {
      if (collision.gameObject.tag == "theobjectToIgnore")
      {
          Physics.IgnoreCollision(theobjectToIgnore.collider, collider);
      }
Posted by: Guest on May-05-2020

Code answers related to "how to detect collision of some other gameobject unity"

C# Answers by Framework

Browse Popular Code Answers by Language