/// <summary> /// 移除组件 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="path"></param> public static void RemoveUIComponent <T>(this Entity self, string path = "") where T : Entity { var component = self.GetUIComponent <T>(path); if (component != null) { component.BeforeOnDestroy(); UIEventSystem.Instance.OnDestroy(component); self.GetCompoennts()[path].Remove(typeof(T)); component.Dispose(); } }
public static GameObject GetGameObject(this Entity self) { UITransform uitrans; if (self.GetType() != typeof(UITransform)) { uitrans = self.GetUIComponent <UITransform>(""); } else { uitrans = self as UITransform; } uitrans.ActivatingComponent(); return(uitrans.transform?.gameObject); }