Search Unity

ArchetypeChunk.StartIndex doesn't exist?

Discussion in 'Data Oriented Technology Stack' started by illinar, Dec 16, 2018.

  1. illinar

    illinar

    Joined:
    Apr 6, 2011
    Posts:
    557
    I need this exact functionality, but I don't see StartIndex in my chunks. This is from the docs:

    Code (CSharp):
    1. struct CollectValues : IJobParallelFor
    2. {
    3.     [ReadOnly] public NativeArray<ArchetypeChunk> chunks;
    4.     [ReadOnly] public ArchetypeChunkComponentType<EcsTestData> ecsTestData;
    5.  
    6.     [NativeDisableParallelForRestriction] public NativeArray<int> values;
    7.  
    8.     public void Execute(int chunkIndex)
    9.     {
    10.         var chunk = chunks[chunkIndex];
    11.         var chunkStartIndex = chunk.StartIndex;
    12.         var chunkCount = chunk.Count;
    13.         var chunkEcsTestData = chunk.GetNativeSlice(ecsTestData);
    14.  
    15.         for (int i = 0; i < chunkCount; i++)
    16.         {
    17.             values[chunkStartIndex + i] = chunkEcsTestData[i].value;
    18.         }
    19.     }
    20. }
    upload_2018-12-16_12-43-11.png
     
    Last edited: Dec 16, 2018
  2. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    1,370
    It has long been removed
     
  3. illinar

    illinar

    Joined:
    Apr 6, 2011
    Posts:
    557
    What's the alternative?
     
  4. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    1,370
    IJobChunk
     
  5. illinar

    illinar

    Joined:
    Apr 6, 2011
    Posts:
    557
    Thanks. IJobChunk is pretty nice.