PhysicsMask
Create a PhysicsMask by specifying multiple bits to set (1).
Read time 1 minuteLast updated a day ago
Definition
- Type: Constructor
- Namespace: Unity.U2D.Physics
- Assembly: UnityEngine.PhysicsCore2DModule
PhysicsMask(int[])
Create a PhysicsMask by specifying multiple bits to set (1).
public PhysicsMask(params int[] bitIndices)
Parameters
The indices of the bits to set in the mask. An index must be in the range [0, 63].
Remarks
Each value is the index of a single bit to set, not a mask of bits. An integer that holds a layer mask, such as the value of a LayerMask, is not converted here and is read as a bit index instead. For example, a layer mask with only layer 8 set has the value 256, which is read as bit index 256 and throws an exception, and a layer mask of 3 sets bit 3 rather than bits 0 and 1. To create a PhysicsMask from a layer mask, pass the LayerMask itself to PhysicsMask. If the layer mask is held in an integer, convert it first, for example .
new PhysicsMask((LayerMask)layerMaskValue)PhysicsMask(LayerMask)
Create a PhysicsMask from a LayerMask. A LayerMask is only 32-bits wide so the PhysicsMask will have the upper 32-bits set to zero.
public PhysicsMask(LayerMask layerMask)
Parameters
The LayerMask to use.