Incorrectly specified that system couldn't already exist
Highlight difference to ScriptBehaviourUpdateOrder.AppendWorldToCurrentPlayerLoop
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.
Create
WorldExtension
and a method to bulk create systems sequentially ensuring each system has completedOnCreate
before moving to the next system.Tag Alongs
WorldUtil.SetupTopLevelGroupsInCurrentPlayerLoop
Improve docsScriptBehaviourUpdateOrder.AppendWorldToCurrentPlayerLoop
What is the current behaviour?
Unity's existing solution
World.GetOrCreateSystemsAndLogException
instantiates all system's before callingComponentSystemBase.OnCreate
on each system.This means that systems calling
world.GetOrCreateSystem
in their ownOnCreate
method may get back a system instance that has not yet hadOnCreate
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) callingComponentSystemBase.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?