LayerMask.NameToLayer Manual     Reference     Scripting  
Scripting > Runtime Classes > LayerMask
LayerMask.NameToLayer

static function NameToLayer (layerName : String) : int

Description

Given a layer name, returns the layer index as defined by either a Builtin or a User Layer in the Tag Manager

JavaScript
Debug.Log(LayerMask.NameToLayer("TransparentFX"));

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
void Example() {
Debug.Log(LayerMask.NameToLayer("TransparentFX"));
}
}

import UnityEngine
import System.Collections

class example(MonoBehaviour):

def Example():
Debug.Log(LayerMask.NameToLayer('TransparentFX'))