Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

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:
    732
    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,998
    It has long been removed
     
  3. illinar

    illinar

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

    eizenhorn

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

    illinar

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