Scroll List Problem

I want to create an item menu controllable by arrow keys, much so like the one in most Final Fantasy Games and various other JRPGs. So I chose to use a selection grid.

alt text

Now, this is currently my OnGUI function:

function OnGUI()
{
	scrollPosition = GUI.BeginScrollView(Rect (10,10,220,300),scrollPosition, Rect (0, 0, 220, 400));

	for(var i : ConsumableItem in itemBag)
	{
	    //Reason: Using a built-in array
		var newBag = new Array(selectionStrings);
		//Add the item to the temp bag
		//var newItemName : String = (i.name + " : " + i.itemAmount);
		newBag.Add(i.name);
		Debug.Log(i.name + " has been picked up");
		//Add the contents of the temporary bag into the main bag
		selectionStrings = newBag.ToBuiltin(String);
	}
	
	selectionGridInt = GUILayout.SelectionGrid (activeSelected, selectionStrings, 1, GUILayout.Width(200));  
	
	GUI.EndScrollView();
}

The list is to automatically populate as I add new items, (which it appears to be doing in the inspector), however, I can’t keep it from duplicating the same entry repeatedly, (and i know the reason for that is because of my loop)

Figured it out (how silly of me). I just needed to add the entry of the item in the same function that I add the item to the actual inventory’s array.

One array holds the string (stringArray)
The other array holds the item (itemArray)

When I add an item to the itemArray, I add a string to the stringArray at the same.