x


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?

more ▼

asked May 02 '11 at 07:37 AM

tomekkie gravatar image

tomekkie
33 9 9 16

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

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.

more ▼

answered May 02 '11 at 07:49 AM

Eric5h5 gravatar image

Eric5h5
80.1k 41 132 519

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)

May 02 '11 at 07:57 AM tomekkie

@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.

May 02 '11 at 06:02 PM Eric5h5
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3316
x214
x81
x38

asked: May 02 '11 at 07:37 AM

Seen: 1166 times

Last Updated: May 02 '11 at 07:37 AM