EntityComponentSystemSamples icon indicating copy to clipboard operation
EntityComponentSystemSamples copied to clipboard

Examples/Jobs IJobChunk Doesn't Work

Open coarsecrunch opened this issue 2 years ago • 0 comments

Docs/examples/jobs.md

[BurstCompile]
    public void Execute(in ArchetypeChunk chunk,
            int unfilteredChunkIndex,
            bool useEnableMask,
            in v128 chunkEnabledMask)
    {
        // Get the entity ID and component arrays from the chunk.
        NativeArray<Entity> entities =
                chunk.GetNativeArray(ref EntityHandle);
        NativeArray<Foo> foos =
                chunk.GetNativeArray(ref FooHandle);
        NativeArray<Bar> bars =
                chunk.GetNativeArray(ref BarHandle);

NativeArray<Entity> entities = chunk.GetNativeArray(ref EntityHandle);

Should instead be:

NativeArray<Entity> entities = chunk.GetNativeArray(EntityHandle);

EntityTypeHandle has to be passed by value GetNativeArray.

coarsecrunch avatar Dec 21 '22 14:12 coarsecrunch