using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class EvacuationPanel : MonoBehaviour { public Transform personnelContent; public Panel panel; public GameObject personnelPrefabs; public GameObject classPrefab; public Transform content; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { } public void SetPersonnel() { foreach (Transform child in personnelContent) { Destroy(child.gameObject); } foreach (var sceneEntry in panel.sceneDataDictionary) { GameObject item = GameObject.Instantiate(personnelPrefabs, personnelContent); PersonnelItem personnelItem=item.GetComponent(); personnelItem.sceneText.text = sceneEntry.Key; personnelItem.personnelNum.text = sceneEntry.Value.Count.ToString(); } } }