Hi there,
I'm trying to set a value from a system, as I'm still beginning with ECS.
I don't understand why this doesn't work:
[BurstCompile]
struct ChickenMovementJob : IJobChunk
{
public ComponentTypeHandle<AgentBody> AgentBodyTypeHandle;
// public float DeltaTime;
[BurstCompile]
public void Execute(in ArchetypeChunk chunk, int unfilteredChunkIndex, bool useEnabledMask, in v128 chunkEnabledMask)
{
AgentBody t;
NativeArray<AgentBody> agents = chunk.GetNativeArray(ref AgentBodyTypeHandle);
var enumerator = new ChunkEntityEnumerator(useEnabledMask, chunkEnabledMask, chunk.Count);
while (enumerator.NextEntityIndex(out var i))
{
t = agents[i];
t.Destination = new float3(30, 0, 0);
t.IsStopped = false;
agents[i] = t;
}
}
}
[BurstCompile]
public partial struct ChickenMovementSystem : ISystem
{
private EntityQuery getChickenQuery;
[BurstCompile]
public void OnCreate(ref SystemState state)
{
SystemAPIQueryBuilder queryBuilder = SystemAPI.QueryBuilder(); // error points HERE
queryBuilder = queryBuilder.WithAll<ChickenComponent>();
queryBuilder = queryBuilder.WithAllRW<AgentBody>();
getChickenQuery = queryBuilder.Build();
}
[BurstCompile]
public void OnUpdate(ref SystemState state)
{
var chickenMovementJob = new ChickenMovementJob();
chickenMovementJob.AgentBodyTypeHandle =
state.GetComponentTypeHandle<AgentBody>(isReadOnly: false);
state.Dependency = chickenMovementJob.ScheduleParallel(getChickenQuery, state.Dependency);
}
}```
I get this error :
InvalidOperationException: No suitable code replacement generated, this is either due to generators failing, or lack of support in your current context