using System.Collections; using System.Collections.Generic; using UnityEngine; using AX.MessageSystem; using AX.TrackRecord; public class LoadNameText : MonoBehaviour { private TextMesh Nametext; private void Awake() { Nametext = GetComponent(); MessageDispatcher.AddListener("LoadTextMesh", loadTextMesh); } public void loadTextMesh(IMessage mes) { ObjAttribute oriObj = (ObjAttribute)mes.Data; if (oriObj.ObjName == gameObject.name) { Nametext.color = oriObj.jijiequ.color; Nametext.text = oriObj.jijiequ.Name; Nametext.gameObject.transform.localScale = oriObj.trans.scale; } } private void OnDestroy() { MessageDispatcher.RemoveListener("LoadTextMesh", loadTextMesh); } }