Version: Unity 6.7 Beta (6000.7)
LanguageEnglish
  • C#

BitField32

struct in Unity.Collections

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

Description

A 32-bit array of bits.

Stack allocated, so it does not require thread safety checks or disposal.

Properties

Property Description
Value The 32 bits, stored as a uint.

Constructors

Constructor Description
BitField32 Initializes and returns an instance of BitField32.

Public Methods

Method Description
Clear Clears all the bits to 0.
CountBits Returns the number of bits that are 1.
CountLeadingZeros Returns the number of leading zeroes.
CountTrailingZeros Returns the number of trailing zeros.
GetBits Returns one or more contiguous bits from the bit field as the lower bits of a uint.
IsSet Returns true if the bit at a position is 1.
SetBits Sets a single bit to 1 or 0.
TestAll Returns true if all of the bits in a contiguous range are 1.
TestAny Returns true if any of the bits in a contiguous range are 1.
TestNone Returns true if none of the bits in a contiguous range are 1.