I am new on entity system. I dont know why I am getting this error? Thanks for helps
My code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Unity.Entities;
using Unity.Jobs;
using Unity.Transforms;
using Unity.Mathematics;
using Unity.Physics.Systems;
using Unity.Burst;
[BurstCompile]
[UpdateBefore(typeof(BuildPhysicsWorld))]
public class RotaterController : JobComponentSystem
{
protected override JobHandle OnUpdate(JobHandle inputDeps)
{
float deltaTime = Time.DeltaTime;
Entities.ForEach((ref Rotation rotation, in Rotater rotater) =>
{
rotation.Value = math.mul(rotation.Value,quaternion.RotateZ(rotater.Speed));
}).Run();
return default;
}
}
Error:
InvalidOperationException: The previously scheduled job ExportPhysicsWorld:ExportDynamicBodiesJob writes to the ComponentTypeHandle<Unity.Transforms.Rotation> ExportDynamicBodiesJob.JobData.RotationType. You must call JobHandle.Complete() on the job ExportPhysicsWorld:ExportDynamicBodiesJob, before you can read from the ComponentTypeHandle<Unity.Transforms.Rotation> safely.
Unity.Entities.InternalCompilerInterface.RunJobChunk[T] (T& jobData, Unity.Entities.EntityQuery query, Unity.Entities.InternalCompilerInterface+JobChunkRunWithoutJobSystemDelegate functionPointer) (at