hi,
iam trying to revive an old project, which i tried to migrate to ecs 0.51, but half way into the process i stopped so i really dont know where i left off. I noticed that the following ITriggerEventsJob is not scheduled/executed (you can see the debug.log message is not executed).
Is there anything iam missing here? I checked this migration document but i dont see any difference (except “BufferBase” but this is just a super light wrapper, you can see it below).
Iam trying to upgrade to 1.0, but i first want to get everything working until i work to the next upgrade
[UpdateAfter(typeof(StepPhysicsWorld))]
[UpdateBefore(typeof(EndFramePhysicsSystem))]
[UpdateInGroup(typeof(FixedStepSimulationSystemGroup))]
public partial class CoreTriggerSystem : BufferBase<EndSimulationEntityCommandBufferSystem>
{
private StepPhysicsWorld _stepPhysics;
private EndFramePhysicsSystem _endFramePhysicsSystem;
protected override void Create()
{
_stepPhysics = World.GetOrCreateSystem<StepPhysicsWorld>();
}
protected override void Update(EntityCommandBuffer cmdBuffer)
{
var collisionEventJob = new CollisionEventJob()
{
//stuff
};
Dependency = collisionEventJob.Schedule(_stepPhysics.Simulation, Dependency);
}
}
internal struct CollisionEventJob : ITriggerEventsJob
{
public void Execute(TriggerEvent triggerEvent)
{
Debug.Log("hello!");
ProcessEntity(triggerEvent.EntityA, triggerEvent.EntityB);
ProcessEntity(triggerEvent.EntityB, triggerEvent.EntityA);
}
}
BufferBase:
public partial class BufferBase<TBuffer> : SystemBase where TBuffer : EntityCommandBufferSystem
{
private TBuffer _commandBufferSystem;
protected virtual void Create() { }
protected virtual void Update(EntityCommandBuffer cmdBuffer) { }
protected override void OnCreate()
{
Create();
_commandBufferSystem = World.GetOrCreateSystem<TBuffer>();
}
protected override void OnUpdate()
{
var commandBuffer = _commandBufferSystem.CreateCommandBuffer();
Update(commandBuffer);
_commandBufferSystem.AddJobHandleForProducer(Dependency);
}
}