Hi all, first of all thanks for the replys.
I finally have time to check the solutions. I went with reading the world position for now.
But the job is not happy when I run it in parallel any Ideas (Singlethreaded it works)?
[BurstCompile]
public void OnUpdate(ref SystemState state)
{
new AIControllerJob()
{
physicsWorld = SystemAPI.GetSingleton<PhysicsWorldSingleton>().PhysicsWorld
}.ScheduleParallel();
}
[BurstCompile]
public partial struct AIControllerJob : IJobEntity
{
public PhysicsWorld physicsWorld;
[BurstCompile]
public void Execute(AIDetectionAspect aiDetectionAspect)
{
aiDetectionAspect.Detect(physicsWorld);
}
}
InvalidOperationException: AIControllerJob.JobData.physicsWorld.CollisionWorld.EntityBodyIndexMap is not declared [ReadOnly] in a IJobParallelFor job. The container does not support parallel writing. Please use a more suitable container type.
Unity.Jobs.LowLevel.Unsafe.JobsUtility.ScheduleParallelFor (Unity.Jobs.LowLevel.Unsafe.JobsUtility+JobScheduleParameters& parameters, System.Int32 arrayLength, System.Int32 innerloopBatchCount) (at <10871f9e312b442cb78b9b97db88fdcb>:0)