Skip to content

Fade Rect

eisclimber edited this page Nov 3, 2024 · 3 revisions

Fade Rect

class in ExPresSXR.UI / Extends MonoBehavior
GameObject instantiable via ExPresS XRFade Rect

Description

A HUD Canvas item that can be faded between a certain color (default: black) and transparency. These fades can either be done over a certain time or instantaneous.

It is set to be rendered in layer UI Always on Top, meaning it can be used as a full screen fade.

When used in the context of an XR Rig, the rig provides convenience functions to fade in and out.

Members

Editor Properties

  • Image _fadeImage: Reference to the UnityEngine.UI.Image used for fading.

Public Properties

  • Color fadeColor: The color to be faded to. Default: new(0.0f, 0.0f, 0.0f, 0.0f = Transparent Black.
  • float fadeToBlackTime: Duration in seconds of a fade to black. Default: 0.5f
  • float fadeToClearTime: Duration in seconds of a fade to transparent. Default: 0.5f
  • bool screenCompletelyVisible: (readonly) Getter to check if the fadeColor is fully opaque.
  • bool screenCompletelyHidden: (readonly) Getter to check if the fadeColor is fully transparent.

Public Methods

  • void FadeToColor(bool instant = false): Starts a fade to color. This will be done over the duration of fadeToBlackTime if instant = false or instantaneously otherwise.
  • void FadeToClear(bool instant = false): Starts a fade to clear. This will be done over the duration of fadeToClearTime if instant = false or instantaneously otherwise.

UnityEvents

  • OnFadeToColorCompleted: Emitted when a Fade to Color was completed.
  • OnFadeToClearCompleted: Emitted when a Fade to Clear was completed.

Enums

  • FadeDirection: Specifies the direction of the fade. Either None, ToColor or ToClear

ExPresS XR Wiki

Tutorial Pages

Code Documentation

Clone this wiki locally