How do you put variables, from your own scripts, into folders. For example:
Thanks
Daniel
They have to be arrays, like:
var someNumbers : int[];
Although some variables types, like Vector3 and Vector4, do that too.
–Eric
If you have a custom class, it will display the class’s public variables in a group like that.
Can someone give a few examples?
thanks
Daniel
Well, say you wanted a Vector3 variable (as in your first image).Outside of any function, put the following:
var rndPosition : Vector3;
Save the script and you should see it appear.
The second example image is an array of AudioClips, which are declared as Eric mentioned.
var myClips : AudioClip[];
Thank you.
Daniel
Does javascript have structs also (probably not)?
I think it does. I know it has classes, and their public variables do show up in the inspector.
what if you wanted to group variables ?
eg) A game manager class may have many dozens of public settings for each scene…
AICount
AISkill
AIRace
WorldWeather
WorldAge
WorldTileSet
be great if we could use[Catagory] or [Description] found in System.Component - though they are for WinForms. It’s a good way to organize large amounts of required input in PropertyGrids
If you define a class with the System.Serializable attribute, its variables will be visible in the inspector. See this manual page for details.