using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class PersonnelPanel : MonoBehaviour { public GameObject personnelItem; public Text personelPanelText; public Text personelNumText; public Transform personelContent; public Panel panelInfo; public GameObject personelItem; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { } public void CreatePersonelItem(SelectedInfo person, GameObject parentTransform) { Transform contentTransform = parentTransform.transform.Find("Scroll View/Viewport/Content"); // 实例化一个人员项并将其作为场景面板的子物体 GameObject item = Instantiate(personelItem, contentTransform); PersonnelInfo personnelItem = item.GetComponent(); personnelItem.nameText.text = person.name; // 设置姓名 } }