- Home /
onTrigger functions in disabled script
The "OnTriggerEnter" function, contained in a disabled script - is not supposed to execute on trigger event, I expect. Am I right?
Answer by Eric5h5 · May 02, 2011 at 07:49 AM
It is supposed to execute in a disabled script (by design), and it does. Really the only thing that doesn't run in a disabled script is Update and OnGUI, maybe Start.
Thanks. The answer confirms my experience. I had to use AddComponent(script) instad od enable/cisable script in order to get my scripts working. But it seems a bit confusing to me. Perhaps it should be stated somewhere in docs (if it is not)
@tomekkie: it's stated in the docs, somewhere. It should be stated in the $$anonymous$$onoBehaviour.enabled section too, though, since it's not really clear. Anyway, you can do "if (!enabled) return;" in functions that you don't want to run if the script is disabled, rather than adding/destroying components.
Your answer
