logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class UnityShowModalComponent

    Unity component that listens for specific event signals and triggers modal dialog display.
    Handles event subscription management and modal parameter configuration for the modal system.
    Provides integration between the event dispatcher system and modal dialog functionality.
    Manages button configurations and signal-to-modal mapping for dynamic modal creation.

    Inheritance
    object
    UnityShowModalComponent
    Implements
    IUiShowModal
    IComponent
    IFoundationSettings
    Namespace: Serenity.Modal.Infrastructure.Components
    Assembly: Serenity.UnityModal.Infrastructure.dll
    Syntax
    public class UnityShowModalComponent : UnityViewElement, IUiShowModal, IComponent, IFoundationSettings

    Constructors

    UnityShowModalComponent(GameObject, ILogService)

    Initializes a new instance of UnityShowModalComponent with GameObject and logging service.
    Sets up the base view element functionality for modal triggering.

    Declaration
    public UnityShowModalComponent(GameObject gameObject, ILogService logService)
    Parameters
    Type Name Description
    GameObject gameObject

    The Unity GameObject this component is attached to.

    ILogService logService

    Service for logging operations and error reporting.

    Fields

    ShowModalParameters

    Declaration
    public UiShowModalParameters ShowModalParameters
    Field Value
    Type Description
    UiShowModalParameters

    Parameters containing modal display configuration and content.

    signalTypeTemplate

    Declaration
    public EventDispatcherSignal signalTypeTemplate
    Field Value
    Type Description
    EventDispatcherSignal

    Template event signal that defines which event type this component listens for.

    Properties

    Guid

    Gets or sets the globally unique identifier for this show modal component.

    Declaration
    public string Guid { get; set; }
    Property Value
    Type Description
    string

    The globally unique identifier string.

    Id

    Gets or sets the unique identifier for this show modal component.

    Declaration
    public string Id { get; set; }
    Property Value
    Type Description
    string

    The unique identifier string.

    SignalTypeName

    Gets the type name of the event signal this component listens for.

    Declaration
    public string SignalTypeName { get; }
    Property Value
    Type Description
    string

    The type name of the event signal.

    Methods

    GetSerializedButtons()

    Gets the serialized button data for the modal dialog.
    Provides access to button configuration for external systems and editors.

    Declaration
    public List<SerializedComponentData> GetSerializedButtons()
    Returns
    Type Description
    List<SerializedComponentData>

    A list of serialized button component data.

    Initialize()

    Initializes the component with event dispatcher service and sets up event subscription.
    Locates the game settings service and retrieves the event dispatcher for modal operations.
    Establishes the connection between this component and the global event system.

    Declaration
    public void Initialize()
    Exceptions
    Type Condition
    Exception

    Thrown when required services are not found or are null.

    InitializeParameters(IComponentParameters)

    Initializes the component with provided modal parameters.
    Sets up signal type configuration, button data, and component identification.
    Validates parameter types and ensures proper initialization of modal button collections.

    Declaration
    public void InitializeParameters(IComponentParameters parameters)
    Parameters
    Type Name Description
    IComponentParameters parameters

    The component parameters containing modal configuration.

    Exceptions
    Type Condition
    Exception

    Thrown when parameters are invalid or of wrong type.

    ShowModal(EventDispatcherSignal)

    Triggers the display of a modal dialog when the specified event signal is received.
    Creates button components from serialized data and dispatches the show modal event.
    Validates modal parameters before proceeding with modal creation and display.

    Declaration
    public void ShowModal(EventDispatcherSignal signal)
    Parameters
    Type Name Description
    EventDispatcherSignal signal

    The event dispatcher signal that triggered this modal display.

    Implements

    IUiShowModal
    IComponent
    IFoundationSettings
    In this article
    © 2026 Serenity. All Rights Reserved