Example #1
0
        /// <summary>
        /// Fades a canvas group's alpha from current to target value.
        /// </summary>
        /// <param name="canvasGroup">CanvasGroup that we're fading</param>
        /// <param name="target">The final alpha value</param>
        /// <param name="fullTransitionDuration">The time the fade would take across a 0->1 or 1->0 fade</param>
        /// <param name="setInteractableOnComplete">Sets the canvas group's interactable and blocks raycast settings to this value once fade finished</param>
        public static IEnumerator FadeCanvasAlpha(this CanvasGroup canvasGroup, float target, float fullTransitionDuration, bool setInteractableOnComplete)
        {
            yield return(canvasGroup.FadeCanvasAlpha(target, fullTransitionDuration));

            canvasGroup.interactable   = setInteractableOnComplete;
            canvasGroup.blocksRaycasts = setInteractableOnComplete;
        }