logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class 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.

    Inheritance
    object
    ModalOptionSignalDispatcher
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Serenity.Modal.Infrastructure.Factories
    Assembly: Serenity.UnityModal.Infrastructure.dll
    Syntax
    public class ModalOptionSignalDispatcher

    Constructors

    ModalOptionSignalDispatcher(IEventDispatcherService, ILogService)

    Declaration
    public ModalOptionSignalDispatcher(IEventDispatcherService eventDispatcherService, ILogService logService)
    Parameters
    Type Name Description
    IEventDispatcherService eventDispatcherService
    ILogService logService

    Methods

    Dispatch(UiOption)

    Dispatches every submit signal the option carries, unless a dispatch is already running.

    Declaration
    public void Dispatch(UiOption option)
    Parameters
    Type Name Description
    UiOption option

    The submitted option whose signals to dispatch.

    In this article
    © 2026 Serenity. All Rights Reserved