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;
最后修改:2011年3月6日 Sunday 11:35

本脚本参考基于Unity 3.4.1f5

英文部分版权属©Unity公司所有,中文部分© Unity圣典 版权所有,未经许可,严禁转载 。