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

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

using UnityEngine;
using System.Collections;

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

import UnityEngine
import System.Collections

class example(MonoBehaviour):

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