public int cullingMask ;

Description

This is used to render parts of the Scene selectively.

如果 GameObjectlayerMask 和摄像机的 cullingMask 的逻辑与为零,则游戏对象在该摄像机中不可见。 有关更多信息,请参阅

另请参阅:摄像机组件

using UnityEngine;

public class ExampleClass : MonoBehaviour { Camera cam;

void Start() { // Only render objects in the first layer (Default layer) cam.cullingMask = 1 << 0; } }