For the developer encount the framework which is not familiar, There's some period for the adaptation. The case of me is pretty same. I participated in team project and there's a framework that I've never been used. With my low knowledge, I tried to implement inventory with the basic of tutorial lecture. Attaching itemslots on the inventory, the code structure was designed like
public class UIInventory : MonoBehaviour
{
[SerializeField] UIItemSlot[] slots;
void Start()
{
Init()
}
void Init()
{
SetInventorySlot()
}
void SetInventorySlot()
{
slots = new UIItemSlot[27];
for(int i=0; i<slots.Length; i++)
{
// 동적생성
UIItemSlot itemSlot = Manager.UI.MakeSubItem<UIItemSlot>(gameobject.transform);
slots[i] = itemSlot;
}
}
}
Previously, I tried this with the drag-and-drop method in inspector. There is a comment. When you participate the large project, there are so many errors occur at the inspector. In order to prevent that situation, we have to learn the method of controlling by script.
Previous settings
Slot prefabs were attached by developer. In that case, the object name should be tuned with the script.
Current settings
the UI_ItemSlot
were instantiated by script.