I’m working in a game with canvas for the moment. One is containing the menu, the other the game.
I also have an object containing the gameManager that is managing the game, hide show, bootstrap, etc.
I basically have almost everything active under each and then I enable disable the parent.
The thing is that as you work daily, under each canvas there are more objects, components etc. So when you work in order to see things you have to disable and enable stuff, so u see them in the editor and you dont see all of them mixed.
The thing is that eventually you allways forget which one should be enabled and disabled at run time so I decided to write a function to put them in order. So at the awake of gameManager I set all of them to setActive (true) and then I have to put them in menu state which mean setActive false for all excepting the menu parent.
The funny thing here is that for some modules its about setActive (true) and false in a row, and then the awake is not being trigger for some reason. Looks like the awake is async against the setactive and its set to false before is trigger, so I cannot pre allocate the awake for anyone so when I try to call some functions its not ready yet.
Is there a way to pre activate all the modules so I trigger the awakes before I launch any logic againts them. Because the thing is that if I trigger in the same function setActive(true) and then a call to a function of this object the awake is not triggered yet.