logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class UnityLoadingOverlayProgressAnimator

    Smooths the gameplay loading overlay's displayed progress toward the reported target so instantaneous progress jumps (e.g. a scene that loads in milliseconds) still render as a visible bar fill, and defers the overlay teardown until the bar has visibly reached 100%.

    Inheritance
    object
    UnityLoadingOverlayProgressAnimator
    Namespace: Serenity.Ui.Infrastructure.Views
    Assembly: Serenity.UnityUi.Infrastructure.dll
    Syntax
    public class UnityLoadingOverlayProgressAnimator : MonoBehaviour
    Remarks

    Runs on unscaled time because the game clock may be paused during scene loads (PauseDuringSceneLoad zeroes Time.timeScale). Attached to the overlay root by UnityGameplayLoadingOverlayView; destroying itself destroys the whole overlay.

    Constructors

    UnityLoadingOverlayProgressAnimator()

    Declaration
    public UnityLoadingOverlayProgressAnimator()

    Methods

    CompleteThenDestroy()

    Forces the target to 100% and destroys the GameObject this animator is attached to once the displayed bar reaches it, capped by Serenity.Ui.Infrastructure.Views.UnityLoadingOverlayProgressAnimator.FINISH_SAFETY_TIMEOUT_SECONDS so the teardown can never hang.

    Declaration
    public void CompleteThenDestroy()
    Remarks

    The cap cannot fire for a caller that only goes through UnityGameplayLoadingOverlayView: the fill and the elapsed timer consume the same unscaled delta, the fill three times faster, so from a full target the bar reaches 100% in a third of a second against a half-second cap and wins at any frame rate. Only a target lowered after this call can stall the fill, and the view drops its animator reference in Hide(), so it never lowers one. The cap is therefore for direct consumers of this public component, and that is the path UnityLoadingOverlayProgressAnimatorTests exercises — asserting through the view would prove nothing.

    Initialize(Action<float>)

    Sets the callback that renders the displayed progress (slider fill + percentage label).

    Declaration
    public void Initialize(Action<float> renderProgress)
    Parameters
    Type Name Description
    Action<float> renderProgress

    SetTarget(float)

    Sets the normalized progress value the displayed bar animates toward.

    Declaration
    public void SetTarget(float normalized)
    Parameters
    Type Name Description
    float normalized
    In this article
    © 2026 Serenity. All Rights Reserved