LayerMask.value 值

var value : int

Description描述

Converts a layer mask value to an integer value.

转换一个层蒙版值到一个整数值。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	public LayerMask mask = -1;
	void Update() {
		if (Physics.Raycast(transform.position, transform.forward, 100, mask.value))
			Debug.Log("Hit something");

	}
}
// Casts a ray using the layer mask,
// which can be modified in the inspector.
//使用层蒙板投射一条射线
//它可以在检视面板中修改

var mask : LayerMask = -1;
function Update () {
		if (Physics.Raycast (transform.position, transform.forward, 100, mask.value)) {
			Debug.Log("Hit something");
	}
}
Page last updated: 2011-2-24