Search Unity

Returning NativeList from a method

Discussion in 'Entity Component System' started by Srokaaa, Dec 12, 2018.

  1. Srokaaa

    Srokaaa

    Joined:
    Sep 18, 2018
    Posts:
    169
    It seems that NativeList forgets it's allocator type when it is being returned from a method. When debuger breakpoint is set inside the method and I inspect the list I see this:

    After I exit the the method and inspect returned value I see this:


    m_AllocatorLabel is now Invalid and when I try to Dispose the list I get:
    Code (CSharp):
    1. InvalidOperationException: The NativeArray can not be Disposed because it was not allocated with a valid allocator.