文档

Unity Engine


User Manual

Script Reference

Unity Engine


Remove a layer from a layerMask

Remove a layer from a layerMask via script.
阅读时间1 分钟最后更新于 25 天前

To remove a layer from a layermask, use the logical AND operator on the original layermask and the bitwise complement of the layer to remove it.
originalLayerMask &= ~(1 << layerToRemove);

Additional resources