I’m using an Array for a SelectionGrid, and my problem is if I have the “size” property in the Inspector set to lets say 10, there will be 10 buttons, and I may not be using all of them.
How could I change the “size” property of the inspector in my scripts? I’m not sure how to access it, and trying .size and .length does not seem to work?
You can’t resize built-in arrays, you can only re-initialize them with a different size.
var stringArray : String[];
function Start () {
stringArray = new String[20]; // make stringArray have 20 entries
}
–Eric
There is also the System.Array.Resize function:-
Or for yet another option, you can convert your built-in array to a normal array, resize it as needed, then convert it back to a built-in array.