decline-cookies / anvil-unity-dots

Unity DOTS and ECS specific additions and extensions to Anvil
MIT License
4 stars 1 forks source link

WorldExtension - Sequential Create #250

Closed mbaker3 closed 1 year ago

mbaker3 commented 1 year ago

Create WorldExtension and a method to bulk create systems sequentially ensuring each system has completed OnCreate before moving to the next system.

Tag Alongs

What is the current behaviour?

Unity's existing solution World.GetOrCreateSystemsAndLogException instantiates all system's before calling ComponentSystemBase.OnCreate on each system.

This means that systems calling world.GetOrCreateSystem in their own OnCreate method may get back a system instance that has not yet had OnCreate called.

This is particularly problematic for TaskDriver instances that need system references to be fully initialized to configure jobs against the system's exposed data.

What is the new behaviour?

Executing world.GetOrCreateSystemsSequentiallyAndLogExceptions will create each system in the list sequentially (if required) calling ComponentSystemBase.OnComplete on the system before progressing to the next system.

What issues does this resolve?

What PRs does this depend on?

Does this introduce a breaking change?

mbaker3 commented 1 year ago

requested changes addressed.