hey all, I'm trying to make a Inventory system. For now I have: Code (csharp): using UnityEngine; using System.Collections; using System.Collections.Generic; public class Inventory : MonoBehaviour { public int Gold; private Vector2 scrollPosition = Vector2.zero; static private ArrayList items = new ArrayList(); static public bool Show = false; static public void AddNew(string name) { //Show = true; items.Add(name); } void OnGUI(){ if(Show == true){ scrollPosition = GUI.BeginScrollView(new Rect (10,10,200,270),scrollPosition, new Rect (0, 0, 200, 400)); int b = 0; int i = 0; while(i < items.Count) { GUI.Button(new Rect(0,b,100,40),items[i].ToString()); b +=50; i++; } GUI.EndScrollView(); GUI.Label(new Rect(10,280,200,30),"Gold:" +Gold,"box"); } } void Update(){ if(Input.GetKeyUp("i")){ if(!Show){ Show = true; }else if(Show){ Show = false; } } } } But now the while statement is called infinite when GUI is displayed. I know thats because OnGUI gets called every frame, but because of that there are more buttons of the same button/item. That's not what I want. So does someone know a other way to add a item and a button to the inventory without getting it duplicated(no loop in OnGUI)?