NameToLayer(string)
Given a layer name, returns the layer index as defined by either a Builtin or a User Layer in the Tags and Layers manager.
Read time 1 minuteLast updated 9 days ago
Definition
- Type: Method
- Namespace: UnityEngine
- Assembly: UnityEngine.CoreModule
public static int NameToLayer(string layerName)
Parameters
Returns
Type | Description |
|---|---|
| int |
Remarks
Returns -1 if not found.
Examples
using UnityEngine;public class Example : MonoBehaviour{ void Start() { Debug.Log(LayerMask.NameToLayer("TransparentFX")); }}