What does the flag 'enabled' on scripts actually do?
Hi there, I'm having some trouble with the flag "enabled" when using it with scripts.
I'm currently testing it with three simple scripts: "Fruit", "Apple" and "Orange". Apple and Orange inherit from Fruit.
Fruit as a method called "justDie" that calls another virtual method called "justReset". Then the Apple and the Orange both override that method.
I have one object called "TestObject". TestObject have both Apple and Orange attached and another script to simply control the enabled flag on those scripts.
The Orange overrides "justReset" mehod and as the flag "enabled" set to false.
Now I have another script that instantiates a fruit and then calls the method "justDie". What happens is that the Orange "justReset" method is the one being used, even though the Orange script is disabled.
Aren't the scripts independent?
Your answer
![](https://koobas.hobune.stream/wayback/20220612040729im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Get reference to dynamically added script 1 Answer
How to inherit from a class that inherits from MonoBehaviour 1 Answer
Recursive SetParent not working 1 Answer
Waring, using new keyword on monovehaviour. When im not using monobehaviour!? 1 Answer
Getting Value from Function in another Script without knowing Script type 0 Answers