docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method CreateOrResizeNativeArrayIfNecessary

    CreateOrResizeNativeArrayIfNecessary<T>(int, Allocator, ref NativeArray<T>)

    Creates or resizes the array if necessary. If array has been allocated and its length is equal to length, then this method does nothing. If its length is different, then it is first disposed before being assigned to a new NativeArray.

    Declaration
    protected static void CreateOrResizeNativeArrayIfNecessary<T>(int length, Allocator allocator, ref NativeArray<T> array) where T : struct
    Parameters
    Type Name Description
    int length

    The length that array will have after this method returns.

    Allocator allocator

    If allocation is necessary, this allocator will be used to create the new NativeArray.

    NativeArray<T> array

    The array to create or resize.

    Type Parameters
    Name Description
    T

    The type of elements held by the array.

    In This Article
    Back to top Copyright © 2023 Unity Technologies — Terms of use
    Generated by DocFX
    on Friday, September 22, 2023