camera.cullingMask &= ~(1 << maskLayer);解释一下这串代码
时间: 2024-05-29 09:10:14 浏览: 149
The cullingMask property in Unity's Camera class is used to determine which layers in the scene should be rendered by the camera. It is a bitmask that represents the layers that are visible to the camera. The default value is set to -1, which means that all layers are visible to the camera. Developers can set the cullingMask property to a specific layer or a combination of layers to control what the camera should render. This is useful for optimizing performance by avoiding rendering unnecessary objects in the scene.
阅读全文