Answer the question
In order to leave comments, you need to log in
How to competently implement OnDisable and OnDestroy?
To begin with, I have a question, why are there so many stupid people in the unit? What is the logic behind the implementation of OnDisable and OnDestroy??
Let's say I have a GameObject - a store page, I need to include additional onEnable and OnDisable. elements. That is, we logically build a chain, when the object turns on and off, I do additional. processing.
BUT why is it so stupidly done that when OnDestroy works OnDisable ?? It's just insanity.
It turns out that when the scene / object is destroyed, it always handles OnDisable and do calculations there. That is, these are absolutely useless calculations at the time of the destruction of the object.
Why couldn't it be human? You need to disable the object, put the code in OnDisable , you need to destroy the object onDestroy .
Thank God that they were smart enough not to call Awake, Start, OnEnable when destroying )))))
Or am I just stupid, I guess? How do you get around this? It's not about ending the game.
Answer the question
In order to leave comments, you need to log in
How do you get around this?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question