Hello, I’m having issues getting a basic DOTS lambda to run. My OnUpdate() is as follows:
protected override void OnUpdate()
{
Debug.Log("situationRequestHandler");
var buffer = Buffer;
var situationBuilder = SituationBuilder;
// Not sure if entityInQueryIndex will work for jobchunk id.
Entities
.ForEach((Entity entity, ref BuildSituationRequest request) =>
{
var e = buffer.CreateEntity(situationBuilder);
var s = new Situation();
s.stageId = request.stageId;
buffer.SetComponent(e, s);
buffer.DestroyEntity(entity);
})
.WithBurst()
.Run();
}
Right now I’m manually building a BuildSituationRequest entity for testing purposes. In my Entity Debugger I can clearly see that there is an entity with a BuildSituationRequest component on it. Under the “Used by Systems” tab, it knows it’s used by the system with OnUpdate() method showed above. Additionally, the Debug.Log in the OnUpdate is ran, so I know this System is running. However, the Entities.ForEach doesn’t run. In the Entities.ForEach I create an entity and destroy one. However, the original entity still exists and the new entity is never created. What could I be doing wrong?