Home

Published

- 1 min read

unity check collider layer

img of unity check collider layer

The solution for this is noted below

unity check collider layer

Solution

   function OnCollisionEnter(collision : Collision)
 {
     if (collision.collider.gameObject.layer == LayerMask.NameToLayer("LAYER_NAME"))
     {
          Debug.Log("Touched a rail");
     }
 }

Try other methods by searching on the site. That is if this doesn’t work