logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class UnityGlobalService

    Unity MonoBehaviour implementation of IGlobalService providing application-level services.
    Manages event dispatching, application lifecycle (exit/restart), and global service coordination with scene management integration and event subscription handling.

    Inheritance
    object
    UnityGlobalService
    Implements
    IGlobalService
    IService
    IFoundationSettings
    Namespace: Serenity.Global.Infrastructure.Services
    Assembly: Serenity.UnityGlobal.Infrastructure.dll
    Syntax
    public class UnityGlobalService : MonoBehaviour, IGlobalService, IService, IFoundationSettings

    Constructors

    UnityGlobalService()

    Declaration
    public UnityGlobalService()

    Properties

    Guid

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

    Id

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

    LogService

    Declaration
    public ILogService LogService { get; set; }
    Property Value
    Type Description
    ILogService

    Methods

    ExitApplication()

    Exits the Unity application.

    Declaration
    public void ExitApplication()

    GetEventDispatcherService()

    Gets the event dispatcher service instance.

    Declaration
    public IEventDispatcherService GetEventDispatcherService()
    Returns
    Type Description
    IEventDispatcherService

    The configured event dispatcher service

    Initialize(IEventDispatcherService, string, ILogService)

    Initializes the global service with event dispatcher and initial scene configuration.

    Declaration
    public void Initialize(IEventDispatcherService eventDispatcherService, string initialSceneName, ILogService logService)
    Parameters
    Type Name Description
    IEventDispatcherService eventDispatcherService

    Event dispatcher service for global communication

    string initialSceneName

    Name of the initial scene for restart functionality

    ILogService logService

    InitializeEventDispatcher(IEventDispatcherService)

    Initializes the event dispatcher and subscribes to application events.

    Declaration
    public void InitializeEventDispatcher(IEventDispatcherService eventDispatcherService)
    Parameters
    Type Name Description
    IEventDispatcherService eventDispatcherService

    Event dispatcher service to configure

    RestartApplication()

    Restarts the application by loading the initial scene.

    Declaration
    public void RestartApplication()

    SetEventDispatcherService(IEventDispatcherService)

    Sets the event dispatcher service instance.

    Declaration
    public void SetEventDispatcherService(IEventDispatcherService eventDispatcherService)
    Parameters
    Type Name Description
    IEventDispatcherService eventDispatcherService

    Event dispatcher service to set

    SubscribeToEventDispatcherEvents()

    Subscribes to application lifecycle events through the event dispatcher.

    Declaration
    public void SubscribeToEventDispatcherEvents()

    Implements

    IGlobalService
    IService
    IFoundationSettings
    In this article
    © 2026 Serenity. All Rights Reserved