logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Namespace Serenity.Modal.Infrastructure.Factories

    Classes

    ModalOptionSignalDispatcher

    Dispatches a modal option's submit signals, exactly once per press.

    The press is not naturally once: a modal option's signals are dispatched synchronously, and one of them can switch the active input action map (EndGameSessionSignal returns to the menu mode, which re-enables the UI map). Re-enabling a map while Submit is still held re-fires Submit on the modal, which is still alive at that moment, so the same option dispatches its whole signal list a second time from inside the first dispatch. The second pass is what destroyed the modal underneath the first one and produced the NullReferenceException on close.

    A ReentrancyGate answers this without depending on Input System internals: the nested submit is refused, and the outer one finishes normally. The gate's scope is one dispatcher, which is one modal service, so a submit on a different modal is unaffected.

    Accepted limitation: while an option's signals are dispatching, a synchronous submit of ANOTHER option is refused too, not queued. No authored flow does that today — a modal option's signals close the modal or change mode; they do not submit a sibling option — and a queue would need a policy for what to do when the modal is gone by the time the queue drains.

    UnityModalButtonFactory

    Unity-specific factory for creating interactive button components for modal dialogs.
    Generates buttons with associated event handlers and submit actions based on provided data.
    Encapsulates the complex button creation process including theme sound mapping and event wiring.

    UnityModalOptionComponentCreator

    Creates a single modal option UI component (slider, toggle, selector, dropdown, input, submit) from a UiOption. This is the modal counterpart of UnityMenuComponentCreator: it reuses the same per-interaction parameter/factory construction, but wires interaction callbacks to view-free modal handlers — value changes persist through UnityModalComponentFactory (game settings by id, identical to menus) and submits dispatch the option's OnSubmitSignal. Selection/focus/navigation callbacks are intentionally left unwired (the modal component drives selection by index via its controller, exactly as the legacy submit buttons did).

    UnityModalOptionsBuilder

    Builds the interactable components for a modal from its rich UiOption array, the modal counterpart of UnityMenuOptionsBuilder. Each option is rendered via UnityModalOptionComponentCreator, seeded with its initial game-settings value (identical to menus), and visually initialized; the resulting IUiInteractable list is handed to the modal component, which parents and lays it out. Replaces the submit-only UnityModalButtonFactory.

    In this article
    © 2026 Serenity. All Rights Reserved