using System.Collections; using System.Collections.Generic; using UnityEngine; public class TradeUnion : MonoBehaviour { public GameObject gonghuiPrefab; public Transform content; public int count; public List dataList = new List(); // Start is called before the first frame update void Start() { ReadData(); } public async void ReadData() { UnionPage unionPage = new UnionPage(); UnionPage16 unionPage16 = new UnionPage16(); unionPage = await unionPage16.queryUnionPage(1); Debug.Log(unionPage.Data.TotalCount); count = unionPage.Data.TotalCount; dataList = unionPage.Data.DataList; for(int i = 0; i < dataList.Count; i++) { GameObject union = GameObject.Instantiate(gonghuiPrefab, content); union.name = "union_" + i; //这里动态挂载公会脚本 } } // Update is called once per frame void Update() { } }