public void Use() { dragAndDrop = ItemUI.gameObject.GetComponent <DragAndDrop>(); if (item.type == ItemType.Food) { FoodObject food = (FoodObject)item; playerInfo.AddHp(food.HealthRestore); playerInfo.AddMana(food.ManaRestore); playerInfo.AddStanima(food.HungerRestore); dragAndDrop.IfSetSlotsOccupied(false, false); inventoryData.RemoveItem(item); Destroy(ItemUI.gameObject); Debug.Log("Used"); Destroy(gameObject); } }