public void Update() { if (Input.GetButtonDown("Inventory")) { if (uiInventory.IsOpen) { uiInventory.CloseInventory(); } else { uiInventory.OpenInventory(); } } }