This is likely to do with all of Javas implicit background items.
If an object does not have an Update(fixedUpdate as well) or Start function it will not be enableable or disableable. This is because there is no use to being able to disable something that doesn’t update. You can still call functions on a disabled Monobehaviour and disabling just prevents the initial Start call and disables updating for that object.
If you add an Update function it should become enableable.
my “derived class” implements a specialization of a coroutine and I’d love to enable/disable coroutines execution in the editor simply by turning off the component.
Adding an empty void Start(){} does the trick but I’m wondering if there’s any special keyword to put somewhere (something like [System please_show_the_disable_checkbox]) to force it and save all the fake calls on Start.
Do you know if anything like this is available?
thanks again
putting in a fake start does the trick there though.
Guess the reasoning is that a component that is never actively used ( start, update, ongui), it also does not do any active job and thus does not need to be disabled.
its important that a lot of things on monobehaviours are not touched at all by disabling it, its those 3 functions I mentioned above that are primarily touched by disable
ok just wondering because if you try to start a coroutine on a disabled script/component (or disable the script after starting the coroutine) it simply won’t start (/will stop) so in that case enable/disable has a meaning also if the component itself doesn’t start/update/ongui anything.
Thank you to both of you anyway, this community is just great as always
Indeed, with coroutines it likely has to do with the fact that the “coroutine schedule” checks for yield in the global update round and only checks active behaviors
thats also the reason why coroutines are affected by timeScale (at least from what I recall, they are), cause timeScale affects Update
Is there still no way to get this checkbox without adding an Update function? I’d love to use the script enabled state to use it in my own logic, but without needing to add an Update function. I know I could add a bool variable to do this and check it in update, but it’s not so… nice.