docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class NativeArrayUtils

    Utility methods for working with NativeArray_1 objects.

    Inheritance
    object
    NativeArrayUtils
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Unity.XR.CoreUtils
    Assembly: Unity.XR.CoreUtils.dll
    Syntax
    public static class NativeArrayUtils

    Methods

    EnsureCapacity<T>(ref NativeArray<T>, int, Allocator, NativeArrayOptions)

    Ensure that this array is large enough to contain the given capacity.

    Declaration
    public static void EnsureCapacity<T>(ref NativeArray<T> array, int capacity, Allocator allocator, NativeArrayOptions options = NativeArrayOptions.ClearMemory) where T : struct
    Parameters
    Type Name Description
    NativeArray<T> array

    The array reference. Overwritten if the original array has insufficient capacity.

    int capacity

    The minimum number of elements that the array must be able to contain.

    Allocator allocator

    The allocator to use when creating a new array, if needed.

    NativeArrayOptions options

    The options to use when creating the new array, if needed.

    Type Parameters
    Name Description
    T

    The type of array element.

    Remarks

    If the array does not have sufficient capacity, it is disposed and a new, empty array is created.

    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)