using System; using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; using UnityEngine.UI; public class addressItem : MonoBehaviour { public TextMeshProUGUI nameTxt;//名称 public TextMeshProUGUI addressTxt;//地址 public TextMeshProUGUI telTxt;//电话 public Button editBtn;//编辑按钮 public GameObject editPanelPrefab; public Transform trans; // Start is called before the first frame update void Start() { trans = GameObject.Find("Canvas").transform; editBtn.onClick.AddListener(Edit); } public void Edit() { GameObject.Instantiate(editPanelPrefab, trans); } // Update is called once per frame void Update() { } public void SetInfo(Address address) { nameTxt.text = address.receiveName; addressTxt.text = address.address; telTxt.text = address.receivePhone; } }