I have no idea why this is not safe, seems so simple what am I missing here
InvalidOperationException: The previously scheduled job CreateTileEntitySystem:<>c__DisplayClass_CreateTileEntitySystem reads from the NativeArray <>c__DisplayClass_CreateTileEntitySystem.safety. You must call JobHandle.Complete() on the job CreateTileEntitySystem:<>c__DisplayClass_CreateTileEntitySystem, before you can deallocate the NativeArray safely.
Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle.CheckDeallocateAndThrow (Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle handle) <0x174aae3d0 + 0x00052> in <8ffa1ce5ca714d4bbf5ca6c83220b963>:0
namespace Universe.Planet.Systems
{
[UpdateInGroup(typeof(SimulationSystemGroup))]
public class CreateTileEntitySystem : SystemBase
{
BeginInitializationEntityCommandBufferSystem EntityCommandBufferSystem;
protected override void OnCreate()
{
base.OnCreate();
EntityCommandBufferSystem = World.GetOrCreateSystem<BeginInitializationEntityCommandBufferSystem>();
}
protected override void OnUpdate()
{
var commandBuffer = EntityCommandBufferSystem.CreateCommandBuffer().ToConcurrent();
Entities
.WithName("CreateTileEntitySystem")
.WithChangeFilter<PlanetBuildComponent>()
.WithBurst(FloatMode.Default, FloatPrecision.Standard, true)
.ForEach((Entity e, int entityInQueryIndex, in PlanetBuildComponent b ) =>
{
for (var i = 0; i < b.VertexCount; i++)
{
}
}).ScheduleParallel(Dependency);
EntityCommandBufferSystem.AddJobHandleForProducer(Dependency);
}
}
}