public virtual void OnDestroy() { EventCenter.DelListenersByTarget(this); if (onDestroy != null) { onDestroy(); } if (m_ViewComponents != null) { for (int i = 0; i < m_ViewComponents.Count; i++) { m_ViewComponents[i].OnDestroy(); } m_ViewComponents = null; } m_ViewComponents = null; }