Search Unity

Unity 2019.1.5f1 complains NativeContainer not assigned (.4 did not)

Discussion in 'Entity Component System' started by Arkade, Jun 5, 2019.

  1. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    655
    Just updated from .4 to .5 and receive this error:

    InvalidOperationException: The NativeContainer JointCreationJob.entitiesWithJointCreationQueued has not been assigned or constructed. All containers must be valid when scheduling a job.​

    I allocate it in my Job at the top of
    Execute()
    with
    NativeList<Entity>(count, Allocator.Temp)
    and
    Dispose()
    of at the bottom. It's assigned to a private member of the Job struct just to save passing it to every call of a sub-method. Is this new .5 behaviour correctly reported as wrong, is this a bug or have I missed something (maybe an annotation to indicate use)?

    Thanks.
     
  2. sngdan

    sngdan

    Joined:
    Feb 7, 2014
    Posts:
    1,154
    Maybe it is the Dispose() --- Temp allocated containers are automatically disposed and do not need a manual call
     
  3. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,761
    Show code

    Also if you're allocating within a job (temp) don't call dispose on it
     
    SergeyRomanko likes this.