public void Execute() { int chunkCount = RemapChunks.Length; for (int iChunk = 0; iChunk < chunkCount; ++iChunk) { var chunk = RemapChunks[iChunk].chunk; var dstArchetype = RemapChunks[iChunk].dstArchetype; int numSharedComponents = dstArchetype->NumSharedComponents; var sharedComponentValues = chunk->SharedComponentValues; if (numSharedComponents != 0) { var alloc = stackalloc int[numSharedComponents]; for (int i = 0; i < numSharedComponents; ++i) { alloc[i] = RemapShared[sharedComponentValues[i]]; } sharedComponentValues = alloc; } ChunkDataUtility.MoveArchetype(chunk, dstArchetype, sharedComponentValues); } }