using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class AddressPanel : MonoBehaviour { public GameObject addressPrefab; public Transform trans; public GameObject newAdPanelPrefab; public Transform tran; public Button newAddressBtn; void Start() { getData(); newAddressBtn.onClick.AddListener(NewAddress); } public void NewAddress() { GameObject.Instantiate(newAdPanelPrefab, tran); } public async void getData() { AdressResponse adressResponse = new AdressResponse(); AdressList83 adressList83 = new AdressList83(); adressResponse = await adressList83.AdressList(); int length = adressResponse.data.Count; for (int i = 0; i < length; i++) { //Debug.Log(i); GameObject addres = GameObject.Instantiate(addressPrefab, trans); addres.name = "address_" + i; addressItem item = addres.GetComponent(); Address address = adressResponse.data[i]; item.SetInfo(address); } } }