- 设置组件layer
-
- 修改组件layer为需要隐藏的layer
- 隐藏组件
-
- 修改layer为隐藏状态
CenterCam.GetComponent<Camera>().cullingMask &= ~(1 << 6); // 隐藏player图层
- 显示组件
- 修改layer为显示状态
CenterCam.GetComponent<Camera>().cullingMask |= (1 << 6); // 显示player图层
标签:layer,unity,GetComponent,组件,CenterCam,隐藏 From: https://www.cnblogs.com/LeorI/p/17006210.html