- Home /
Are scripts on a disabled game object disabled aswell?
I have this little script that basically sets gameObject.active to false when I click the object, however I can't seem to activate it again, so my question is:
Is this because of my script being attached to the game object I am disabling? Does disabling a game object also disable any scripts attached to them?
If so then I know why I can't get it to activate again, if not, well I'll have another question ready for you guys soon enough...8D
Anyways, thanks in advance!
Answer by BiG · Jan 10, 2012 at 08:55 AM
Yes, that's the reason. Disabling a gameObject implies the deactivation of all scripts attached to it. The common way to handle this is to assign at a "neutral" object - that's never deactivated -, the settings about "(de)activation" and other tasks like that.
Ah ok, I keep learning stuff here every day...haha! Anyway, thanks for clearing that up!:D