layerName | Provide a rendering layer name. |
int Returns -1 if not found.
Given a rendering layer name, returns the rendering layer index as defined in the Tags and Layers manager.
using UnityEngine; using UnityEngine.Rendering;
public class Example : MonoBehaviour { void Start() { // Prints the name of the rendering layer 1
Debug.Log(RenderingLayerMask.NameToRenderingLayer("Default")); } }