//My disable function public float Disable() { if (m_enabled) { m_enabled = false; //Use return value from play actions being called to start coroutine float time = CUIFunctions.PlayAction(m_onDisabled, this.gameObject); StartCoroutine(CUIFunctions.DisableAfter(time, this.gameObject)); return(time); } return(0); }
public float Disable() { if (m_enabled) { m_enabled = false; //ICUIElement[] childrenElements = GetComponentsInChildren<ICUIElement>(); float time = 0; foreach (ICUIElement element in childrenElements) { float duration = element.Disable(); if (time < duration) { time = duration; } } StartCoroutine(CUIFunctions.DisableAfter(time, this.gameObject)); return(time); } return(0); }