docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class ArrayUtilities

    Utility class for converting Array types from one type to another without copying.

    Inheritance
    object
    ArrayUtilities
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Unity.SimulationPro
    Assembly: Unity.SimulationPro.Capture.dll
    Syntax
    public static class ArrayUtilities

    Methods

    Allocate<T>(int)

    Helper method to ensure you always allocate arrays as byte[], the reason being that the length will be unchanged when casted, so best to always use byte[].

    Declaration
    public static T[] Allocate<T>(int length)
    Parameters
    Type Name Description
    int length

    Length of the byte array.

    Returns
    Type Description
    T[]

    Casted array of type T backed by a byte array of the appropriate size.

    Type Parameters
    Name Description
    T

    Cast type.

    Cast<T>(Array)

    Casts an input array to type T if supported by the cast map.

    Declaration
    public static T[] Cast<T>(Array array)
    Parameters
    Type Name Description
    Array array

    Input array to be casted.

    Returns
    Type Description
    T[]

    Array of type T.

    Type Parameters
    Name Description
    T

    Cast type.

    Count<T>(T[])

    Returns actual count of a casted array.

    Declaration
    public static int Count<T>(T[] array)
    Parameters
    Type Name Description
    T[] array

    Input casted array

    Returns
    Type Description
    int

    Actual count of a casted array

    Type Parameters
    Name Description
    T

    Cast type.

    In This Article
    Back to top
    Copyright © 2026 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)