Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


Remove a layer from a layerMask

Remove a layer from a layerMask via script.
Read time 1 minuteLast updated 21 days ago

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