As title,
When those are called exactly?
If UI gameobject become visible (SetActive(true)), then OnEnable called?
And when change to another scene, then Start, OnEnable called again?
As title,
When those are called exactly?
If UI gameobject become visible (SetActive(true)), then OnEnable called?
And when change to another scene, then Start, OnEnable called again?
I feel that page needs to be updated big time as it doesn’t seem to be accurate for the SRP.
In my scenario, I’ve tested two print statements. One is done from a Mono’s OnDisable method, the other from a method that is called via the onEndFrameRendering event. The OnDisable should be called after onEndFrameRendering, yet it is called before (both prints show the same frame number).
Did you hit the feedback stuff at the bottom and offer your suggestion?
No, the flowchart is still correct (i guess), it just does not cover all possible actions you may do while the application is running. OnEnable and OnDisable are both directly called from inside the enable property or when you activate / deactivate an object. The flowchart only shows the life-cycle. So the OnDisable at the very bottom happens when your application is quit. That should be obvious since OnApplicationQuit comes before that. The “normal” gameloop branches off before that.
It’s impossible to draw a flowchart of every possibiiity, especially your own actions which you carry out in Update. Awake also is not always called at the very top. Awake also may be called immediately when you first activate an object. This could happen anywhere. So this flow chart gives you a rough overview of various callbacks during the normal lifecycle.
OnDisable is called immediately when you call Destroy() too. In fact, it’s perfect to find out who’s destroying the object by looking at the call stack.
Yes
I’m not sure how I didn’t think about that. How stupid!
Yet, the chart does have some inaccuracies for SRP, at least in the Scene Rendering call backs/events.