Is there a way to do so without writing custom bootstrap?
I’ve tried using UpdateAfter, but it doesn’t work unfortunately.
I want a system that runs after EndSimulationEntityCommandBufferSystem, since that system rans monobehaviours update. OrderLast on the EndSimulationECBSystem seems to be always puting it last in the group no matter what other systems attributes have.
Also, it has to be before PresentationSystemGroup / PreLateUpdate, because that would be too late, and that causes 1 frame rendering desync.
If it can be at the very beginning of the PresentationSystemGroup (right after the BeginPresentationEntityCommandBufferSystem), yes, you can with
[UpdateInGroup(typeof(PresentationSystemGroup), OrderFirst = true)]. If not, then you will need a custom bootstrap.
Soo, I’ve tried using custom bootstrap, and it doesn’t seems to help.
If I don’t add my component system group (AfterSimulationGroup) to the SimulationSystemGroup while rest of the systems are added, then manually add it - it still added before EndSimulationEntityCommandBufferSystem;
If I add AfterSimulationGroup after all systems, but before sort, its still added before EndSimulationECBSystem;
System update lists are protected / readonly, so the only option remains is reflection?
Backward compatibility? I guess.
If something not mine, e.g. from plugin will change entities, those changes will not propagate correctly to the monobehaviours update.
Had to discard EndSimulationEntitiyCommandBufferSystem via bootstrap;
Re-added it to the LateSimulationGroup instead via bootstrap;
AfterSimulationGroup runs last now;
No reflection needed, and I’ll get a warning if something is not ordering correctly, which will at least will give me a hint what’s wrong.
Probably not the best solution, but it gets jobs done.
I think I’ve tried that, and it just spit out warnings that EndSimulationEntityCommandBufferSystem is in the different update group. I’ll try that again once I can. Thanks for the suggestion.
Okay, I got it. If the OrderLast is not set to true it just does this:
Ignoring invalid [UpdateAfter] attribute on EntitiesExt.UpdateGroups.AfterSimulationGroup because Unity.Entities.EndSimulationEntityCommandBufferSystem belongs to a different ComponentSystemGroup.
This attribute can only order systems that are children of the same ComponentSystemGroup.
Make sure that both systems are in the same parent group with [UpdateInGroup(typeof(Unity.Entities.SimulationSystemGroup)].
Which is weird, and probably a bug, unless intended.