Renaming Array Elements In The Inspector

Hi all, I have a boolean inbuilt array for describing an object (isBig, isSmall etc)

Obviously when I run the game in the inspector any arrays elements are simply shown as Element0,Element1 etc.

Is there a way to rename element/index numbers?
To clarify, I am comparing one objects properties to another objects properties. I want the following in the inspector for each object:

isBig -Tickbox
isSmall -Tickbox
isYellow -Tickbox
etc

but I would like them as an array so that I can zip through them quickly rather than using a lot of If statements.

I haven’t heard of one, but maybe you could use a hashtable instead (see scripting manual and Hashtable Class (System.Collections) | Microsoft Learn). That is basically a list of key-value pairs. Never used one though, so I can’t really say if it shows up in the inspector.

Cool cheers, I’ll take a look at Hash tables.

From what I know they don’t show up in the inspector, but I guess I could assign their [contents] to other variables which would show up in there.

Let’s see…

Hmm, I just came across enumerator (enum). Apparently these can be seen in the inspector but I have no clue how to use them in Javascript.
Anyone know?

Well I just discoivered this:

enum nodeProperties {Unknown,freezing,big,small,yellow}
var nodeProperty:nodeProperties[];
nodeProperty=new nodeProperties[5];
for(x=0;x<nodeProperty.length;x++)
	{
	nodeProperty[x]=nodeProperties.Unknown;
	}

I can imagine this discovery will be a LOT of use!!

The trouble with an enum is that it is, internally, a single integer. Every element of your array can story any of those enum values, but only one of them. If it’s freezing, it can’t also be big. If it’s small, it can’t also be yellow. This may be what you intended, but from what your initial post it sounds like you want flags, so each of those properties can be turned on or off individually.

The fastest and easiest way to do that, really, would be to not us an array, or anything like it, but just have a hardcoded set of variables, like so:

var unknown : bool;
var freezing : bool;
var big : bool;
var small : bool;
var yellow : bool;

The main reason to use an array, or other list structure, is if you expect this list to change during run-time, or want to be able to change it in the editor without editing the script. Enums also won’t allow this. The values in an enum are just as hard-coded as the list of variables above.

If you need to change the contents of the list dynamically, that’s a whole other can of worms, and will probably require the use of a custom inspector to do properly.