void Update() { if (Input.GetKeyDown(Key)) //Check if the player pressed the I key which enables/disables the inventory. { ToggleInventory(); } if (Input.GetKeyDown(CloseAllPanelsKey)) { //Close inventory panel: if (ShowInv == true) { ToggleInventory(); } //Close container panel: if (InvContainer.ActiveContainer != null) { InvContainer.DesactivatePanel(); } //Close crafting: if (InvCraft.InvCraft.Panel.active == true) { InvCraft.InvCraft.ToggleCrafting(); } //Close equipment panel: if (InvEquipmentUI.Panel.active == true) { InvEquipmentUI.ToggleEquipment(); } if (InvItemGroup.ActiveItemGroup != null) { InvItemGroup.DesactivatePanel(); } if (InvVendor.ActiveVendor != null) { InvVendor.DesactivatePanel(); } } if (Dragging == true) { Vector3 TempPos = Input.mousePosition - UICanvasTrans.localPosition; PanelDragPos.GetComponent <RectTransform>().localPosition = new Vector3(TempPos.x - PanelDragPos.GetComponent <RectTransform>().rect.width / 2, TempPos.y - PanelDragPos.GetComponent <RectTransform>().rect.height / 2, 0); } if (DraggingItem) { Debug.Log(""); Vector3 TempPos3 = Input.mousePosition - UICanvasTrans.localPosition - PanelTrans.localPosition; DragSlot.GetComponent <RectTransform>().localPosition = new Vector3(TempPos3.x - DragSlot.GetComponent <RectTransform>().rect.width / 2, TempPos3.y - DragSlot.GetComponent <RectTransform>().rect.height, 0); } if (EventSystem.current.IsPointerOverGameObject() == false && (Input.GetMouseButton(0) || Input.GetMouseButton(1))) { if (Action == true) { CloseActionMenu(); } } if (Input.GetKeyDown(KeyCode.Return)) { if (DropMenu.active == true) { SendItem(); } } }