ReisenTasker/Assets/Scripts/Inventory/InventoryUIObject.cs

18 lines
550 B
C#

using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class InventoryUIObject : MonoBehaviour
{
public TextMeshProUGUI itemNameText;
public TextMeshProUGUI amountText;
public Image itemIcon;
public void SetObject(Item itemToSet)
{
Debug.Log("here");
itemNameText.text = itemToSet.itemName; //it would be reset every time you open the inventory instead of updating only the amount but whatever it doesn't matter
amountText.text = $"x{InventoryManager.instance.CheckItemAmount(itemToSet)}";
itemIcon.sprite = itemToSet.icon;
}
}