docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class NetcodeBitArrayExtensions

    For UnsafeBitArray. Only needed until those changes land in those packages.

    Inheritance
    object
    NetcodeBitArrayExtensions
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: Unity.NetCode
    Assembly: Unity.NetCode.dll
    Syntax
    public static class NetcodeBitArrayExtensions

    Methods

    FindLastSetBitExt(ref UnsafeBitArray)

    Finds the index of the last true bit in the BitArray, and returns said bit index.

    Declaration
    public static int FindLastSetBitExt(this ref UnsafeBitArray bitArray)
    Parameters
    Type Name Description
    UnsafeBitArray bitArray

    The bitArray to query.

    Returns
    Type Description
    int

    -1 if no true bits found.

    ShiftLeftExt(ref UnsafeBitArray, int)

    Shifts the entire bit array left (in other words: upwards away from 0, towards Capacity). Discards all bits shifted off the top, and all new bits shifted into existence from the bottom are 0.

    Declaration
    public static void ShiftLeftExt(this ref UnsafeBitArray bitArray, int shiftBits)
    Parameters
    Type Name Description
    UnsafeBitArray bitArray

    Instance to apply the operation on.

    int shiftBits

    How far should all the bits be shifted (in number of bits i.e. bit indexes)?

    ShiftRightExt(ref UnsafeBitArray, int)

    Shifts the entire bit array right (in other words: downwards towards 0, away from Capacity). Discards all bits shifted off the bottom, and all new bits shifted into existence at the top are 0.

    Declaration
    public static void ShiftRightExt(this ref UnsafeBitArray bitArray, int shiftBits)
    Parameters
    Type Name Description
    UnsafeBitArray bitArray

    Instance to apply the operation on.

    int shiftBits

    How far should all the bits be shifted (in number of bits i.e. bit indexes)?

    ToDecimalFixedStringExt(ref UnsafeBitArray, int)

    Logs a human-readable format for this bit array.

    Declaration
    public static FixedString4096Bytes ToDecimalFixedStringExt(this ref UnsafeBitArray bitArray, int maxFixedStringLength = 4093)
    Parameters
    Type Name Description
    UnsafeBitArray bitArray

    Instance to apply the operation on.

    int maxFixedStringLength

    Denotes the max fixed string length, if you want a concatenated string.

    Returns
    Type Description
    FixedString4096Bytes

    Example: BitArray[num_bits,length,numTrueBits,indexOfLastTrueBit][10011100-00000000-00100000-00000000-00000000-00000000-00000000-0000000...]

    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)