using System.Collections; using System.Collections.Generic; using UnityEngine; public class OnwayContent : MonoBehaviour { public GameObject itemPre; public void CreateItems(Dictionary>> allCars) { for (int i = 0; i < transform.childCount; i++) { Destroy(transform.GetChild(i).gameObject); } if (itemPre == null) { itemPre = Resources.Load("OnwayForce/OnwayForceItem") as GameObject; } foreach(string team in allCars.Keys) { /*foreach(KeyValuePair pair in allCars[team]) { GameObject item = Instantiate(itemPre, transform); item.GetComponent().Set(team, pair); }*/ foreach(KeyValuePair pair in allCars[team]) { for(int i = 0; i < pair.Value; i++) { GameObject item = Instantiate(itemPre, transform); item.GetComponent().Set(team, i + 1, pair.Key); } } } } }