static NativeArray <EntityInChunkWithGuid> GetSortedEntitiesInChunk ( ArchetypeChunkChangeSet archetypeChunkChangeSet, Allocator allocator, out JobHandle jobHandle, JobHandle dependsOn = default) { var entities = new NativeArray <EntityInChunkWithGuid>(archetypeChunkChangeSet.TotalEntityCount, allocator, NativeArrayOptions.UninitializedMemory); var gatherEntitiesByChunk = new GatherEntityInChunkWithGuid { EntityGuidTypeIndex = TypeManager.GetTypeIndex <EntityGuid>(), Chunks = archetypeChunkChangeSet.Chunks, Flags = archetypeChunkChangeSet.Flags, EntityCounts = archetypeChunkChangeSet.EntityCounts, Entities = entities }.Schedule(archetypeChunkChangeSet.Chunks.Length, 64, dependsOn); var sortEntities = new SortNativeArrayWithComparer <EntityInChunkWithGuid, EntityInChunkWithGuidComparer> { Array = entities }.Schedule(gatherEntitiesByChunk); jobHandle = sortEntities; return(entities); }
public ArchetypeChunkChanges(Allocator allocator) { CreatedSrcChunks = new ArchetypeChunkChangeSet(allocator); DestroyedDstChunks = new ArchetypeChunkChangeSet(allocator); }