Answer the question
In order to leave comments, you need to log in
What happens to an object when it is disabled via setactive?
When an object is active it renders and loads the memory, when it is destroyed the memory is freed, but what exactly happens when it is disabled? What links does unity store in order to enable it at any time, and how big is the difference between a disabled object and a destroyed one in terms of memory occupied and processor load
Answer the question
In order to leave comments, you need to log in
For a disabled object, all Update and FixedUpdate and
a bunch of utility methods simply stop running. Rendering is in fact also part of the update.
The object itself is alive and well, you can refer to it, call methods, and so on. You can even move around the stage - no problem.
So with t.z. memory difference is maximum - the destroyed one takes 0 memory, the disabled one - all that it needs and can only be slightly less than the one that is not turned off.
Of course, everything can be a little more complicated - like there are also coroutines, hierarchy updates (especially for UI), exclusion from the physics graph, and so on - but the essence is the same.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question