|
Has anyone else come across this? A script that I disable with the code below disables for an instant, then doesn't stay disabled any longer (I know this by debugging).
I don't have it being enabled anywhere in my code and I can't figure out why it becomes enabled again. TerrainScript does have a Update function but I can't imagine that making a difference.
(comments are locked)
|
|
For debugging purposes, one thing I like to do is break down any multiple-step statements, and check that every step worked. For instance, you could do:
It's possible that something is breaking somewhere (maybe mispelling/typo), and it's not obvious. Also - what do you mean by not disabled? I can't find the Answer again, but I remember Duck posting somewhere, that disabling a script only disables certain functions, like Update(), etc. Some things - specifically OnMouseUp(), for instance, stay enabled, and so the script will respond to mouse clicks. Is that what's happening? Uhm, this is interesting... but I can't understand why. If somebody wants to stop a script why it's not possible to do that completely?
May 21 '10 at 03:32 PM
GODLIKE
@GODLIKE, as @Duck pointed out to me (wish I could find it again), it enables the script to be re-enabled by mouse-click. If the script stopped responding to everything, and you wanted it re-enabled, then some other Object would have to read mouse-clicks, find the script, and enable it. Way too complex.
May 21 '10 at 03:48 PM
Cyclops
(comments are locked)
|
|
The only thing I could think of is that your code somewhere is in fact enabling it again, without you realizing it. Try putting the terrain and this script in a seperate scene, and see if it still happens.
(comments are locked)
|
