The "OnTriggerEnter" function, contained in a disabled script - is not supposed to execute on trigger event, I expect.
Am I right?
May 02 '11 at 07:37 AM
Sep 10 '11 at 01:37 PM
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.
May 02 '11 at 07:49 AM
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 MonoBehaviour.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.
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
Once you sign in you will be able to subscribe for any updates here
Answers and Comments
The best place to ask and answer questions about development with Unity. Check out our FAQ for more information.
To help users post good questions and use the site effectively we have posted a tutorial video. Please check it out.
asked: May 02 '11 at 07:37 AM
Seen: 1166 times
Last Updated: May 02 '11 at 07:37 AM
Script Not staying disabled
Enable/Disable GameObject Button script
Disabled Script still does OnMouseDown
enable/disable specific components
Disable SCRIPT HELP!!!!
Turn On - off character controller script, is there a way??
Disabling/Enabling Different Character Controllers.
Disable script from code
How do I create a simply disable script for enemy AI once it completes its waypoints?