Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


NameToRenderingLayer(string)

Given a rendering layer name, returns the rendering layer index as defined in the Tags and Layers manager.
Read time 1 minuteLast updated 10 days ago

Definition

  • Type: Method
  • Namespace: UnityEngine
  • Assembly: UnityEngine.CoreModule
public static int NameToRenderingLayer(string layerName)

Parameters

layerName

Provide a rendering layer name.

Returns

Type

Description

intReturns -1 if not found.

Examples

using UnityEngine;using UnityEngine.Rendering;public class Example : MonoBehaviour{ void Start() { // Prints the name of the rendering layer 1 Debug.Log(RenderingLayerMask.NameToRenderingLayer("Default")); }}