public virtual void unload() { PUGameObject p = parent as PUGameObject; if (p != null) { p.removeChild(this); } this.PerformOnChildren(val => { MethodInfo method = val.GetType().GetMethod("gaxb_unload"); if (method != null) { method.Invoke(val, null); } return(true); }); unloadAllChildren(); NotificationCenter.removeObserver(this); if (gameObject != null) { gameObject.SetActive(false); GameObject.Destroy(gameObject); gameObject = null; } rectTransform = null; }