private IEnumerator ShowEnumerator(bool instantAction) { RectTransform.FullScreen(true); Overlay.FullScreen(true); yield return(null); //skip a frame DisableUIInteractions(); UIAnimator.StopAnimations(Container.RectTransform, ShowBehavior.Animation.AnimationType); //stop any SHOW animations Container.Enable(); //enable the gameobject, canvas and graphic raycaster Overlay.Enable(); //MOVE Vector3 moveFrom = UIAnimator.GetAnimationMoveFrom(Container.RectTransform, ShowBehavior.Animation, Container.StartPosition); Vector3 moveTo = UIAnimator.GetAnimationMoveTo(Container.RectTransform, ShowBehavior.Animation, Container.StartPosition); if (!ShowBehavior.Animation.Move.Enabled) { Container.ResetPosition(); } UIAnimator.Move(Container.RectTransform, ShowBehavior.Animation, moveFrom, moveTo, instantAction); //initialize and play the SHOW Move tween //ROTATE Vector3 rotateFrom = UIAnimator.GetAnimationRotateFrom(ShowBehavior.Animation, Container.StartRotation); Vector3 rotateTo = UIAnimator.GetAnimationRotateTo(ShowBehavior.Animation, Container.StartRotation); if (!ShowBehavior.Animation.Rotate.Enabled) { Container.ResetRotation(); } UIAnimator.Rotate(Container.RectTransform, ShowBehavior.Animation, rotateFrom, rotateTo, instantAction); //initialize and play the SHOW Rotate tween //SCALE Vector3 scaleFrom = UIAnimator.GetAnimationScaleFrom(ShowBehavior.Animation, Container.StartScale); Vector3 scaleTo = UIAnimator.GetAnimationScaleTo(ShowBehavior.Animation, Container.StartScale); if (!ShowBehavior.Animation.Scale.Enabled) { Container.ResetScale(); } UIAnimator.Scale(Container.RectTransform, ShowBehavior.Animation, scaleFrom, scaleTo, instantAction); //initialize and play the SHOW Scale tween //FADE float fadeFrom = UIAnimator.GetAnimationFadeFrom(ShowBehavior.Animation, Container.StartAlpha); float fadeTo = UIAnimator.GetAnimationFadeTo(ShowBehavior.Animation, Container.StartAlpha); if (!ShowBehavior.Animation.Fade.Enabled) { Container.ResetAlpha(); } UIAnimator.Fade(Container.RectTransform, ShowBehavior.Animation, fadeFrom, fadeTo, instantAction); //initialize and play the SHOW Fade tween Visibility = VisibilityState.Showing; //update the visibility state if (!VisiblePopups.Contains(this)) { VisiblePopups.Add(this); } ShowBehavior.OnStart.Invoke(gameObject, !instantAction, !instantAction); NotifySystemOfTriggeredBehavior(AnimationType.Show); //send the global events if (HideProgressor != null) { HideProgressor.SetValue(0f); } float startTime = Time.realtimeSinceStartup; if (!instantAction) //wait for the animation to finish { // yield return new WaitForSecondsRealtime(ShowBehavior.Animation.TotalDuration); float totalDuration = ShowBehavior.Animation.TotalDuration; float elapsedTime = startTime - Time.realtimeSinceStartup; while (elapsedTime <= totalDuration) //wait for seconds realtime (ignore Unity's Time.Timescale) { elapsedTime = Time.realtimeSinceStartup - startTime; VisibilityProgress = elapsedTime / totalDuration; yield return(null); } } ShowBehavior.OnFinished.Invoke(gameObject, !instantAction, !instantAction); Visibility = VisibilityState.Visible; //update the visibility state if (!VisiblePopups.Contains(this)) { VisiblePopups.Add(this); } if (AutoHideAfterShow) { Hide(AutoHideAfterShowDelay); } StartCoroutine(ExecuteShowSelectDeselectButtonEnumerator()); //select the selectedButton m_showCoroutine = null; //clear the coroutine reference EnableUIInteractions(); RemoveHiddenFromVisiblePopups(); }