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

给定一个层名称。返回内置的或在tag Maneger中定义的层索引。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	public void Awake() {
		Debug.Log(LayerMask.NameToLayer("TransparentFX"));
	}
}
Debug.Log(LayerMask.NameToLayer("TransparentFX"));
Page last updated: 2011-2-24