Answers for "unity check collider layer"

C#
5

unity check collider layer

function OnCollisionEnter(collision : Collision)
 {
     if (collision.collider.gameObject.layer == LayerMask.NameToLayer("LAYER_NAME"))
     {
          Debug.Log("Touched a rail");
     }
 }
Posted by: Guest on November-08-2020
0

checking a gamobjects layer

if(gameObject.layer == LayerMask.NameToLayer("LAYER_NAME")){}
Posted by: Guest on November-25-2020

Code answers related to "unity check collider layer"

C# Answers by Framework

Browse Popular Code Answers by Language