using UnityEngine; using System.Collections.Generic; using TMPro; using UnityEngine.UI; public class UIBottomInventory : MonoBehaviour { public List inventory = new List(); public Transform content; public TMP_Text text; Image img; private void Awake() { img = GetComponent(); } public void LoadInventory() { for (int i = 0; i < content.childCount; i++) { GameObject obj = content.GetChild(i).gameObject; Destroy(obj); } for (int i = 0; i < inventory.Count; i++) { GameObject prefab = inventory[i]; Instantiate(prefab, content); } } public void RemoveInventory() { for (int i = 0; i < content.childCount; i++) { GameObject obj = content.GetChild(i).gameObject; Destroy(obj); } } public void OnSelect() { img.color = Color.red; text.color = Color.white; } public void OnDeselect() { img.color = Color.white; text.color = Color.black; } }