21 lines
560 B
C#
21 lines
560 B
C#
using UnityEngine;
|
|
using System.Collections.Generic;
|
|
public class UIBottomInventory : MonoBehaviour
|
|
{
|
|
public List<GameObject> inventory = new List<GameObject>();
|
|
public Transform context;
|
|
public void LoadInventory()
|
|
{
|
|
for (int i = 0; i < context.childCount; i++)
|
|
{
|
|
GameObject obj = context.GetChild(i).gameObject;
|
|
Destroy(obj);
|
|
}
|
|
for (int i = 0; i < inventory.Count; i++)
|
|
{
|
|
GameObject prefab = inventory[i];
|
|
Instantiate(prefab, context);
|
|
}
|
|
}
|
|
}
|