直接在事件里使用a.Unit.GetParent<UI> 会提示对象为空,怎样才能操作ui发生变化呢
namespace ET
{
public class UIPlayerMain:AEvent<EventType.UIPlayerMain>
{
protected override async ETTask Run(EventType.UIPlayerMain a)
{
ReferenceCollector rc = a.Unit.GetParent<UI>().GameObject.GetComponent<ReferenceCollector>();
Text loginBtn = rc.Get<GameObject>("Text").GetComponent<Text>();
loginBtn.text = "Hello";
// loginBtn.GetComponent<Button>().onClick.AddListener();
await ETTask.CompletedTask;
}
}
}