[RequireMatchingQueriesForUpdate]
[BurstCompile]
public partial struct MySystem : ISystem
{
[BurstCompile]
public void OnCreate(ref SystemState state) { }
[BurstCompile]
public void OnDestroy(ref SystemState state) { }
[BurstCompile]
public void OnUpdate(ref SystemState state)
{
var ecbSingleton = SystemAPI.GetSingleton<EndSimulationEntityCommandBufferSystem.Singleton>();
var ecb = ecbSingleton.CreateCommandBuffer(state.WorldUnmanaged).AsParallelWriter();
new MyJob() { Ecb = ecb }.ScheduleParallel();
}
}
RequireMatchingQueriesForUpdate Attribute doesn't work as expected. Event if MyJob doesn't match any entity, MySystem still call Update function. And a new command buffer would be created every frame without doing anything. How can I avoid this?