{!See https://docs.google.com/document/d/1takg_GmIBBKKTj-GHZCwzxohpQz7Bhekivkk72kYMtE/edit for reference implementation of OneTrust, dataLayer and GTM} {!OneTrust Cookies Consent} {!OneTrust Cookies Consent end} {!dataLayer initialization push} {!dataLayer initialization push end} {!Google Tag Manager} {!Google Tag Manager end} Method CreateNativeArray | Collections | 2.3.0-pre.3
docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method CreateNativeArray

    CreateNativeArray<T, U>(int, ref U, NativeArrayOptions)

    Create a NativeArray, using a provided allocator that implements IAllocator.

    Declaration
    public static NativeArray<T> CreateNativeArray<T, U>(int length, ref U allocator, NativeArrayOptions options = NativeArrayOptions.ClearMemory) where T : unmanaged where U : unmanaged, AllocatorManager.IAllocator
    Parameters
    Type Name Description
    int length

    The number of elements to allocate.

    U allocator

    The allocator to use.

    NativeArrayOptions options

    Options for allocation, such as whether to clear the memory.

    Returns
    Type Description
    NativeArray<T>

    Returns the NativeArray that was created.

    Type Parameters
    Name Description
    T

    The type of the elements.

    U

    The type of allocator.

    CreateNativeArray<T>(int, AllocatorHandle, NativeArrayOptions)

    Create a NativeArray, using a provided AllocatorHandle.

    Declaration
    public static NativeArray<T> CreateNativeArray<T>(int length, AllocatorManager.AllocatorHandle allocator, NativeArrayOptions options = NativeArrayOptions.ClearMemory) where T : unmanaged
    Parameters
    Type Name Description
    int length

    The number of elements to allocate.

    AllocatorManager.AllocatorHandle allocator

    The AllocatorHandle to use.

    NativeArrayOptions options

    Options for allocation, such as whether to clear the memory.

    Returns
    Type Description
    NativeArray<T>

    Returns the NativeArray that was created.

    Type Parameters
    Name Description
    T

    The type of the elements.

    CreateNativeArray<T>(NativeArray<T>, AllocatorHandle)

    Create a NativeArray from another NativeArray, using a provided AllocatorHandle.

    Declaration
    public static NativeArray<T> CreateNativeArray<T>(NativeArray<T> array, AllocatorManager.AllocatorHandle allocator) where T : unmanaged
    Parameters
    Type Name Description
    NativeArray<T> array

    The NativeArray to make a copy of.

    AllocatorManager.AllocatorHandle allocator

    The AllocatorHandle to use.

    Returns
    Type Description
    NativeArray<T>

    Returns the NativeArray that was created.

    Type Parameters
    Name Description
    T

    The type of the elements.

    CreateNativeArray<T>(T[], AllocatorHandle)

    Create a NativeArray from a managed array, using a provided AllocatorHandle.

    Declaration
    [ExcludeFromBurstCompatTesting("Managed array")]
    public static NativeArray<T> CreateNativeArray<T>(T[] array, AllocatorManager.AllocatorHandle allocator) where T : unmanaged
    Parameters
    Type Name Description
    T[] array

    The managed array to make a copy of.

    AllocatorManager.AllocatorHandle allocator

    The AllocatorHandle to use.

    Returns
    Type Description
    NativeArray<T>

    Returns the NativeArray that was created.

    Type Parameters
    Name Description
    T

    The type of the elements.

    CreateNativeArray<T, U>(T[], ref U)

    Create a NativeArray from a managed array, using a provided Allocator.

    Declaration
    [ExcludeFromBurstCompatTesting("Managed array")]
    public static NativeArray<T> CreateNativeArray<T, U>(T[] array, ref U allocator) where T : unmanaged where U : unmanaged, AllocatorManager.IAllocator
    Parameters
    Type Name Description
    T[] array

    The managed array to make a copy of.

    U allocator

    The Allocator to use.

    Returns
    Type Description
    NativeArray<T>

    Returns the NativeArray that was created.

    Type Parameters
    Name Description
    T

    The type of the elements.

    U

    The type of allocator.

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