Search Unity

Whatever happened to Schedule(NativeList<T>)?

Discussion in 'Entity Component System' started by tertle, Jun 11, 2019.

  1. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,759
    -edit-

    can ignore, I finally found it. Requires IJobParallelForDefer now instead. expected it to be part of the collections package but was in the jobs package.

    -original-

    You could used to do something like this

    Code (CSharp):
    1. var job = new Job
    2. {
    3.     Array = list.AsDeferredJobArray(),
    4. };
    5.  
    6. handle = job.schedule(list, handle);
    7.  
    8. [BurstCompile]
    9. public struct Job : IJobParallelFor
    10. {
    11.     [ReadOnly]
    12.     public NativeArray<Value> Array;
    13.  
    14.     public void Execute(int index)
    15.     {
    16.         var v = this.Array[index];
    17.         // etc
    18.     }
    19. }
    I haven't tried this in 6 months but I had an algorithm that would be perfect for this pattern but I can no longer find the Schedule overload in any package (did a pretty decent.

    It used to require a condition (also for the old ToDeferredArray()).

    AsDeferredJobArray obviously still works and exists but apart from iterating in an IJob what's the point of the DeferredJobArray if you can't schedule it in a parallel job anymore?
     
    Last edited: Jun 11, 2019
    psuong likes this.