docs.unity.cn
    Show / Hide Table of Contents

    Method AllocateNativeList

    AllocateNativeList<T>(Int32)

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

    Declaration
    [GenerateTestsForBurstCompatibility(GenericTypeArguments = new Type[]{typeof(int)})]
    public NativeList<T> AllocateNativeList<T>(int capacity)
        where T : struct
    Parameters
    Type Name Description
    Int32 capacity

    The number of items the list can hold.

    Returns
    Type Description
    NativeList<T>

    Returns the NativeList

    Type Parameters
    Name Description
    T

    The NativeList

    Remarks

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

    Back to top Copyright © 2023 Unity Technologies — Terms of use
    Generated by DocFX
    on Wednesday, September 20, 2023