Example #1
0
        /// <inheritdoc />
        public async void Dismiss(bool animated = true)
        {
            if (m_IsBusy)
            {
                return;
            }

            m_IsBusy = true;

            try
            {
                if (!animated || m_Transition == null || !gameObject.activeSelf)
                {
                    dismissed?.Invoke(this);
                }
                else
                {
                    if (m_Transition != null)
                    {
                        try
                        {
                            await m_Transition.ExitAsync();

                            dismissed?.Invoke(this);
                        }
                        catch (System.Exception e)
                        {
#if UNITY_EDITOR
                            if (!UnityEditor.EditorApplication.isPlaying)
                            {
                                return;
                            }
#else
                            Debug.LogException(e);
#endif
                        }
                    }
                }

                await Task.Delay(200);
            }
            finally
            {
                m_IsBusy = false;
            }
        }