using System.Collections.Generic;
using UnityEngine;

public class UIBuildingMenu : MonoBehaviour
{
    [SerializeField] private UIBuildingButton BuildingButtonPrefab;
    [SerializeField] private List<BuildingData> buildings;

    private void Start()
    {
        for (int i = 0; i < buildings.Count; i++)
        {
            if (i != gameObject.transform.childCount)
            {
                gameObject.transform.GetChild(i).GetComponent<UIBuildingButton>().Initiate(buildings[i]);
            }
            else
            {
                Debug.Log("Missing button");
                UIBuildingButton button = Instantiate(BuildingButtonPrefab, gameObject.transform);
                button.Initiate(buildings[i]);
            }
        }
    }
}
