LayerMask

int layer = LayerMask.NameToLayer("Ground"); //假设=10
LayerMask.GetMask(("Ground"); //相当于 1 << 10

1 << 10 打开第10的层等价于【1 << LayerMask.NameToLayer("Ground");】也等价于【 LayerMask.GetMask(("Ground");】

~(1 << 10) 打开除了第10之外的层。

~(1 << 0) 打开所有的层。

(1 << 10) | (1 << 8) 打开第10和第8的层。等价于【 LayerMask.GetMask(("Ground", "Wall");】

参考

https://www.cnblogs.com/dabiaoge/p/8980224.html

posted @ 2022-01-10 14:10  小帆敲代码  阅读(89)  评论(0编辑  收藏  举报