Can you set a string length when declaring it to a certain other number?

Need to set a texture variable to be the length of a game object variable. How do I do that? I thought I could just use lists and resize it in start ie

var items : List.<GameObject>;
var icons : List.<Texture>;

icons.Count = items.Count; // need something like this in Start function

this works to set the length, but I’m using it for a gui selection grid and get a console error at this line

lineupInt = GUI.SelectionGrid (Rect (0 , 0, boxwidth, boxheight), lineupInt, icons, 3);

the setup I have is to make a selection grid representing the player’s inventory items icons.

Please DO NOT suggest arrays. I’m trying to get off using them. Thanks

System.Array.Resize. (icons, items.Length);

Link to check out

i think you are trying to use the selection grid with these arguments:

static function SelectionGrid(position: Rect, selected: int, images: Texture[], xCount: int): int;

My guess is that argument 3 is the problem. Its supposed to be an array of Textures and you’ve made it a list of no particular type. Whether you want to use arrays or not, that method requires an array of textures and thats what you are going to have to give it.

(im assuming lineupInt is indeed an int)