|
Without making all the variables private and then having to make tons of Get functions, and switch the inspector to debug mode to view values during gameplay. If I save a new value in a script, Unity should update all script instances. Especially if it's just one. How to make the scripts static somehow? It's gonna be one script instance per each script anyway (main player object with a few scripts here and there).
(comments are locked)
|
|
You could set the values of your member variables in Awake(). d'oh. Yeah, and then, after all I said, there's that! :P
Feb 26 '10 at 01:09 PM
Cawas
(comments are locked)
|
|
If you set the value for a variable on the script and outside any function, those variables that will be available on, that's the default value. When you add the script to some object, it will use those values. When you do that, the instanced script will be saved in the project with those values. So, if you later change the script default values, the old ones will persist. If I understand right, you want to override this setting. I highly doubt there's any simple way to do that. But you can set all variables to private, save the script so the inspector will remove the variables, then set it back and save the script again. No need to create get functions at all.
(comments are locked)
|
|
What you want are public member variables for script access but you don't want the editor to access them. There's a built in way to do this, just set the attribute HideInInspector. http://unity3d.com/support/documentation/ScriptReference/HideInInspector.html For Javascript you'd just preface the variable with @HideInInspector. In C# you'd prefix it with [HideInInspector]. (Granted, in C# you'd probably use properties instead of public variables.)
(comments are locked)
|
|
Why set/change a value in the script at all? Just set it only in the Inspector. Because. It's faster for me.
Feb 02 '10 at 05:33 PM
Micha Lewtak 2
(comments are locked)
|

I'm confused. Can you provide an example?