Ok, so I was working on my game, and attached a script to my characters fist so that when he punches and enemy they take damage, anyway so I got the script ready so when he punches the script is activated, otherwise it’s deactivated, and for some reason even when the script is not enabled it is still somehow active, even when I unchecked it in the properties it still is somehow active. Is this just a bug in the Unity3 Beta?
Are you positive that’s the only instance of the script? Try removing that script, and seeing if it’s still “enabled” somewhere.
The Start() and Awake() will always be executed as long as the GameObject is active. Even if the script is deactivated.
Just as an FYI.
Yeah, I deleted the script and their was only one instance of it. Good to know that Start and Awake funtions are still called. Thanks.
?
From previous tests of mine, Awake is always executed whatever the state of the gameObject is. But Start is executed only upon the first activation (deactivating and activating again do not trigger Start again).
Am I wrong ?
I’m not sure about that.
My impression is they don’t get called at all if the GO is disabled.
Well, you were … right and wrong.
To resume things (I just tested it) :
If game object is active then Awake (script state do not matter).
If game object is active AND script is active then Start.