public void InsertItemOnPointer(InventoryItem item) { //Get the mouse position mousePosition = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, 0)); itemOnPointer = true; //Create the object that will follow the mouse. This object contains the item's icon and amount currentStackedItemDivision = Instantiate(stackedItemDivisionPrefab, inventoryUI.transform).GetComponent <StackableItemDivision>(); //Sets the item on the new object that will follow the mouse currentStackedItemDivision.SetItem(item); currentStackedItemDivision.transform.position = new Vector3(mousePosition.x, mousePosition.y, 0); }
public void ClearItemOnPointer() { Destroy(currentStackedItemDivision.gameObject); currentStackedItemDivision = null; itemOnPointer = false; }