_TheStrongestSnail/TheStrongestSnail/Assets/Scripts/Address/AddressPanel.cs

34 lines
834 B
C#
Raw Normal View History

2024-11-27 17:27:53 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AddressPanel : MonoBehaviour
{
public GameObject addressPrefab;
public Transform trans;
void Start()
{
getData();
}
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<addressItem>();
item.SetInfo();
}
}
}