[Suggestion] Two stage initialization
See original GitHub issueHello again, I bet your sick of my suggestions by this point 😄
Unity’s MonoBehaviors have an Awake and Start method, Awake is always called in all scripts before Start, this allows two stages of initialization which makes scripts less dependent on execution order. Scripts with dependencies on other started scripts can use Start to ensure they have already called their Awake code.
One thing I’ve noticed is that Entitas’ initializing systems are very dependent on order. I think more flexibility could be introduced by have two initialization methods, one that is guaranteed to run after the previous initialization method is run on all systems.
Thoughts?
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (7 by maintainers)
Top Results From Across the Web
[Suggestion] Two stage initialization · Issue #119
One thing I've noticed is that Entitas' initializing systems are very dependent on order. I think more flexibility could be introduced by have ......
Read more >Is Two-Step Initialization a Solution or a Symptom?
Sometimes you might be tempted to use a two-stage construction for your object. However, I suggest reevaluating your design principles if ...
Read more >Use cases for two-phase initialization - c++
I've seen a lot of two-phase initialization used. The justification is to call virtual functions from the secondary constructor.
Read more >Two-Phase Initialization in Swift | by Steven Curtis - Medium
The phases. Phase 1. When a designated or convenience initializer is called on a class memory for the instance is allocated, but not...
Read more >A general two-stage initialization for sag ... - ACM Digital Library
Initializing simulations of deformable objects involves setting the rest state of all internal forces at the rest shape of the object.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

You see that this happens because your systems suppose to do more than one thing 😜
The use case would be that if System A creates a entity on init that B is listening to. You could reorder them, but what if B creates an entity that A is listening to.
With the two stage system A and B could register their listeners and in the second stage create their entities.
If SetPool was called again when reseting Entitas it could be used as the first stage, since it’s called before initialize.