logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class UnityStageService

    Unity MonoBehaviour implementation of IStageService. Supports a hybrid authoring model: Stage Prefab (spatial) + ScriptableObjects (tuning). After instantiation, extracts IStageRoot, IRailPathAuthoring, and ISpawnPointResolver from the prefab hierarchy.

    Inheritance
    object
    UnityStageService
    Implements
    IStageService
    IService
    IFoundationSettings
    IUnityStageRuntime
    Namespace: Serenity.Stage.Infrastructure.Services
    Assembly: Serenity.UnityStage.Infrastructure.dll
    Syntax
    public class UnityStageService : MonoBehaviour, IStageService, IService, IFoundationSettings, IUnityStageRuntime

    Constructors

    UnityStageService()

    Declaration
    public UnityStageService()

    Fields

    LOG_CATEGORY

    Declaration
    protected const string LOG_CATEGORY = "StageService"
    Field Value
    Type Description
    string

    _gameWrapper

    Declaration
    protected GameObject _gameWrapper
    Field Value
    Type Description
    GameObject

    _guid

    Declaration
    protected string _guid
    Field Value
    Type Description
    string

    _id

    Declaration
    protected string _id
    Field Value
    Type Description
    string

    _logService

    Declaration
    protected ILogService _logService
    Field Value
    Type Description
    ILogService

    _spawnPointResolver

    Declaration
    protected ISpawnPointResolver _spawnPointResolver
    Field Value
    Type Description
    ISpawnPointResolver

    _stageInstance

    Declaration
    protected GameObject _stageInstance
    Field Value
    Type Description
    GameObject

    _stageRoot

    Declaration
    protected StageRoot _stageRoot
    Field Value
    Type Description
    StageRoot

    _state

    Declaration
    protected StageState _state
    Field Value
    Type Description
    StageState

    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

    SpawnPointResolver

    The spawn point resolver extracted from the instantiated prefab, or null.

    Declaration
    public ISpawnPointResolver SpawnPointResolver { get; }
    Property Value
    Type Description
    ISpawnPointResolver

    StageRoot

    The stage root extracted from the instantiated prefab, or null.

    Declaration
    public IStageRoot StageRoot { get; }
    Property Value
    Type Description
    IStageRoot

    Methods

    CompleteStage()

    Declaration
    public virtual void CompleteStage()

    FailStage()

    Declaration
    public virtual void FailStage()

    GetSnapshot()

    Declaration
    public virtual StageSnapshot GetSnapshot()
    Returns
    Type Description
    StageSnapshot

    InitializeService(IFoundationViewElement, ILogService)

    Initializes the service with required dependencies.

    Declaration
    public virtual void InitializeService(IFoundationViewElement GameWrapper, ILogService logService)
    Parameters
    Type Name Description
    IFoundationViewElement GameWrapper
    ILogService logService

    InstantiateStagePrefab(GameObject)

    Instantiates the given stage prefab and extracts authoring components: StageRoot, RailPathAuthoring, SpawnPointRegistry.

    Declaration
    public virtual GameObject InstantiateStagePrefab(GameObject stagePrefab)
    Parameters
    Type Name Description
    GameObject stagePrefab

    The stage prefab to instantiate.

    Returns
    Type Description
    GameObject

    The instantiated stage GameObject, or null if the prefab is null.

    StartStage(StageId)

    Starts the stage with the given identity.

    Declaration
    public virtual void StartStage(StageId stageId)
    Parameters
    Type Name Description
    StageId stageId

    The stage identity.

    Implements

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