首页 > 其他分享 >unity通过隐藏layer隐藏组件

unity通过隐藏layer隐藏组件

时间:2022-12-26 17:24:09浏览次数:42  
标签:layer unity GetComponent 组件 CenterCam 隐藏

  1. 设置组件layer
    • 修改组件layer为需要隐藏的layer

  1.  隐藏组件
    • 修改layer为隐藏状态
CenterCam.GetComponent<Camera>().cullingMask &= ~(1 << 6); // 隐藏player图层

 

  1.  显示组件  
    • 修改layer为显示状态
CenterCam.GetComponent<Camera>().cullingMask |= (1 << 6); // 显示player图层

 

标签:layer,unity,GetComponent,组件,CenterCam,隐藏
From: https://www.cnblogs.com/LeorI/p/17006210.html

相关文章