For Loop creating GUI.Label Dynamically

The problem I am having is that I am unable to create the GUI.labels dynamically. Ths code below is running through the loop, there are items in playerInv.carrying and the code is in OnGUI too. So pretty much the labels aren’t being created. What is the problem and how can I over come this?

if (GUI.Button(Rect(425,5,100,100),"Show Inventory"))
    {
	    print("Current inventory items:");
	    var invItems : int = 0;
    for (item in playerInv.carrying)
        {
    	   print (item.name + " - Value: " + item.value + " Holding : " + item.quantity + " Net Value: " + item.netValue);
		    invItems ++;
		    var itemName = item.name;
		    GUI.Label(Rect(25, 110+(invItems*20), itemName.Length*8, 20), item.name);
		    GUI.Label(Rect(300,110,200,20),"wefiewjpiofewmp");
		    print("Label Created!");
        }
    }

OnGUI is immediate mode, so it’s redrawn every frame. Anything inside a GUI.Button if statement will therefore only be true for one frame. If you want something to persist, you’d need to use a global variable (probably a boolean) and use that to set the state in the GUI.Button if statement, then check it elsewhere in OnGUI.