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

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!

I was looking up if there are any event functions that is triggered on a disabled script when I ran into your question. I don’t think there are such functions, but if you look at the example on the Unity docs below, OnBecameVisible seems to be triggered even when the script is disabled.

But I don’t think that’s what you’re looking for. If you have a GameObject in the scene that is deactivated at Awake and Start, and you want to set it up when you activate it, you can use OnEnable. If you activate and deactivate it multiple times but you only want to run that function once, you can simply have a boolean variable that you set accordingly.