decline-cookies / anvil-unity-dots

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

TaskDrivers - Split Configure Jobs to it's own function that gets called after the constructor. #282

Open jkeon opened 11 months ago

jkeon commented 11 months ago

Sometimes we have Jobs that refer back up the same stack to a parent TaskDriver.

However, that parent TaskDriver isn't fully initialized yet so it will have null references or be a null reference itself depending on how you get access to it.

As a work around you can call a custom method on your TaskDriver after you instantiate it but that's a bit cumbersome.

A better solution would be to have all TaskDrivers implements an Abstract method to configure their jobs. This method will be called on all TaskDriver's right before Harden is called.

This would ensure the same macro order of operations happens but that the entire chain of relationships (parent and sub taskdrivers) and their data is initialized and ready to go.