Answers for "unity find gameobject with layer"

C#
9

unity get layer of gameobject

// This will retrun the layer mask of the specified gameObject
gameObject.layer

// You can as well modify this value through code
gameObject.layer = LayerMask.NameToLayer("SomeOtherLayer")
Posted by: Guest on September-16-2020
0

unity find gameobject with layer

void Start()
{
    GameObject objByName = FindInActiveObjectByName("Cube");
    GameObject objByTag = FindInActiveObjectByTag("CubeTag");
    GameObject objByLayer = FindInActiveObjectByLayer(LayerMask.NameToLayer("CubeLayer"));
}
Posted by: Guest on June-23-2020

Code answers related to "unity find gameobject with layer"

C# Answers by Framework

Browse Popular Code Answers by Language