Question by
Qwertyyy · Aug 25, 2015 at 02:38 PM ·
monobehaviour
Call a public function of a disabled MonoBehaviour script still work ?
I'm wondering why when you call a public function of a disabled MonoBehaviour script, it still work even if the script is disabled.
This isn't really a problem since I just have to check if enabled == true in my public function, I'm just wondering why it work this way.
Comment
Best Answer
Answer by Landern · Aug 25, 2015 at 02:48 PM
Disabling a script prevents it from having it's MonoBehaviour type methods called(start, awake, update, fixedupdate, lateupdate, etc) by the Unity Engine state machine. Out side of that the objects function as any other and have exposed custom members(properties, fields, methods/functions) that are free to be called as long as you have a reference. Disabling a GameObject doesn't prevent this.