Version: Unity 6.3 LTS (6000.3)
LanguageEnglish
  • C#

PhysicsMask Constructor

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public PhysicsMask(params int[] bitIndicies);

Parameters

Parameter Description
bitIndicies The indices of the bits to set in the mask. An index must be in the range [0, 63].

Description

Create a PhysicsMask by specifying multiple bits to set (1).

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 UnityEngine.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 UnityEngine.LayerMask itself to PhysicsMask. If the layer mask is held in an integer, convert it first, for example new PhysicsMask((LayerMask)layerMaskValue).


Declaration

public PhysicsMask(LayerMask layerMask);

Parameters

Parameter Description
layerMask The LayerMask to use.

Description

Create a PhysicsMask from a LayerMask. A UnityEngine.LayerMask is only 32-bits wide so the PhysicsMask will have the upper 32-bits set to zero.