ScreenFader

  • Creates a canvas as a child of Camera which will be used to fade in and out

  • Requires component of type Camera

Public Fields

float FadeInSpeed

float FadeOutSpeed

bool IsFadeInProgress

UnityEvent onFadeInStart

UnityEvent onFadeInEnd

UnityEvent onFadeOutStart

UnityEvent onFadeOutEnd

Public Methods

void DoFadeIn()

void DoFadeOut()

float GetCanvasGroupAlphaValue()

Example

private IEnumerator DoTeleport()
{
    screenFader.DoFadeIn();
            
    while (screenFader.GetCanvasGroupAlphaValue() != 1f)
    {
        yield return new WaitForEndOfFrame();
    }
    
    Teleport();
    screenFader.DoFadeOut();
}

Last updated