- Home /
Default References of a Script
As of now I am trying to make my game multiplayer, and for my script I need it to let me set up default values for it. For example I have this.
public var reticule : GUITexture[]; var colorOn : Color; var colorOff : Color;
var colorOnFriendly : Color;
but they wont show up in the Default References area of a script. But if I have this, this does.
var example : Rigidbody;
How do I get my colors and GUITextures etc to show up in the default references?
EDIT : Ive figured out the colors thanks to the below comment but I still can figure out the GUITexture. Help would be appreciated.
Answer by Mike 3 · Jan 09, 2011 at 05:36 PM
Strange that reticule isn't showing up, but Colors won't show up - the idea is that you set the defaults in code, which you can't do with unity object references.
i.e.
var colorOn : Color = Color(1,1,1,1);
Edit:
Looks like arrays of items won't show up in the default references. I'm not sure if it's a bug or a limitation, but worth bug reporting at any rate
Thank you. Do you have any idea why the textures might not be working?
Changed my answer to reflect why, but boils down to arrays not working, for that you're going to have to stick to doing them on the component itself after adding it to a gameobject
Your answer
Follow this Question
Related Questions
Public variables null after assigned in the inspector. 3 Answers
How to use Resources in custom EditorWindow? 1 Answer
Assigning Default References to a script itself versus a GameObject using that script? 1 Answer
The proper way of setting up scenes 1 Answer
Where is Mono 1.2.5 assembly reference as used by Unity? 1 Answer