Camera.cullingMask 消隐遮罩

var cullingMask : int

Description描述

This is used to render parts of the scene selectively.

这个用来选择性的渲染部分场景。

If the GameObject's layerMask AND the camera's cullingMask is zero then the game object will be invisible from this camera. See Layers for more information.

如果GameObject的layerMask与相机的cullingMask进行cullingMask操作后为0,那么这个游戏物体对于该相机是不可见的。参考Layers获取更多信息。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	public void Awake() {
		camera.cullingMask = 1 << 0;
	}
}
// Only render objects in the first layer (Default layer)
//只渲染在首个层中的物体(默认层)

camera.cullingMask = 1 << 0;
Page last updated: 2012-9-11