- Home /
Function that Runs Even on Disabled GameObjects
Are there any default functions that run even if the GameObject is disabled?
For example, a GameObject that is disabled in the editor but is enabled when playing?
Awake does not work
Answer by MacDx · Apr 22, 2019 at 09:19 PM
Not that I'm aware of, but you can always make your own. You could create a game manager script, and have a list of game objects you want your stuff executed on, then on the game managers awake or start, whatever you preffer, you call whatever method you want on those game objects, could be a method from the game manager itself or you could even create an interface, have scripts on those objects that implement the interface and call the interface's method.
Hope this helps!
Thank you for the answer, though it isn't exactly what I was looking for. I might try it though.
But that's not the object running itself, that's an external trigger. Quite different.
Same as I said on your other comment. You expect a deactivated object to have behaviour when deactivating specifically disables all behaviour the object has.
You seem to have a logical error in your reasoning. You probably use the activated state of a gameobject for something it may not be used for. You can disable individual components to change the behaviour of the gameobject. The activate state takes the whole gameobject completely out.
No, my comment was about external triggering not being the answer, which it isn't when wanting an object to do an action itself. You're getting two things confused.
Your answer
Follow this Question
Related Questions
DontDestroyOnLoad() not calling awake/start again 2 Answers
Object reference becomes null between Awake and Start after scene load 2 Answers
does finction start or awake run when the object or script is enabled mid game 3 Answers
Component's Start/Awake methods not being called 2 Answers
Start, Awake, Update. Any other ways to call functions from an empty GameObject? 3 Answers