docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method AllocateNativeArray

    AllocateNativeArray<T>(int)

    Allocate a NativeArray of type T from memory that's guaranteed to remain valid until Rewind() is called on the Scratchpad.

    Declaration
    public NativeArray<T> AllocateNativeArray<T>(int length) where T : unmanaged
    Parameters
    Type Name Description
    int length

    The number of items in the NativeArray.

    Returns
    Type Description
    NativeArray<T>

    Returns the NativeArray.

    Type Parameters
    Name Description
    T

    The NativeArray.

    Remarks

    This memory isn't shared between threads and you don't need to Dispose the NativeArray so it's allocated. You can't Dispose the memory to free it: it's automatically freed when Rewind() is called.

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