question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Suggestion] Two stage initialization

See original GitHub issue

Hello 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:closed
  • Created 7 years ago
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
mzakscommented, Jun 17, 2016

You see that this happens because your systems suppose to do more than one thing 😜

0reactions
JamesMcMahoncommented, Jun 17, 2016

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found