Booleans acting wierd

This has been bugging me for a little while, but I’ve kinda just shrugged it off.

Sometimes, I create a Boolean variable in a script (using javascript) and default it to true when I declare it. Now, that works about 70% of the time. But I have a few bools that can only be set to true if I check them in the UnityGUI. No matter how much I change them in script, they won’t change unless that check box is marked. It seems to randomly happen, too. No real correlation between the bools that decided to do this. Any insight would be appreciated. Thanks!

There isn’t anything random; values in variables are always decided by what they are set to in the inspector, not what’s in the script, except for the first time when the default value is assigned. Private variables always use the value set in the script (since they can’t be set in the inspector).

–Eric

I see. I guess I’m a little more of a coder and expect things in script to be the final say. Still getting used to UnityGUI, but loving ever minute of it! :smile:

Thanks for the info!