Answers for "set object layer unity"

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
3

set object layer unity

// Put the game object in the ignore raycast layer (2)using UnityEngine;
using System.Collections;public class ExampleClass : MonoBehaviour
{
    void Example()
    {
        gameObject.layer = 2;
    }
}
Posted by: Guest on January-18-2021

C# Answers by Framework

Browse Popular Code Answers by Language