logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Interface IGameSpawnerService

    Service interface for managing entity spawning and pooling.

    Namespace: Serenity.GameSpawner.Application.Interfaces
    Assembly: Serenity.GameSpawner.Application.dll
    Syntax
    public interface IGameSpawnerService : IService, IFoundationSettings
    Remarks

    Spawning is treated as a request, not a construction detail. This service returns opaque handles that represent spawned instances. Engine-specific instantiation (e.g. Unity GameObjects) is deferred to infrastructure implementations.

    Methods

    Despawn(SpawnHandle)

    Despawns (returns to pool) the entity referenced by the handle.

    Declaration
    void Despawn(SpawnHandle handle)
    Parameters
    Type Name Description
    SpawnHandle handle

    The handle of the entity to despawn.

    DespawnAll()

    Despawns all currently active entities across all types.

    Declaration
    void DespawnAll()

    DespawnAll(SpawnType)

    Despawns all currently active entities of the specified type.

    Declaration
    void DespawnAll(SpawnType type)
    Parameters
    Type Name Description
    SpawnType type

    The spawn type to despawn.

    GetPoolState(SpawnType)

    Gets the pool state snapshot for the specified spawn type.

    Declaration
    PoolStateSnapshot GetPoolState(SpawnType type)
    Parameters
    Type Name Description
    SpawnType type

    The spawn type to query.

    Returns
    Type Description
    PoolStateSnapshot

    A PoolStateSnapshot describing pool usage.

    IsActive(SpawnHandle)

    Gets whether the specified handle references an active entity.

    Declaration
    bool IsActive(SpawnHandle handle)
    Parameters
    Type Name Description
    SpawnHandle handle

    The handle to check.

    Returns
    Type Description
    bool

    True if the entity is currently active; otherwise false.

    Spawn(SpawnType)

    Requests spawning of an entity of the specified type.

    Declaration
    SpawnHandle Spawn(SpawnType type)
    Parameters
    Type Name Description
    SpawnType type

    The logical spawn type.

    Returns
    Type Description
    SpawnHandle

    A SpawnHandle referencing the spawned instance.

    In this article
    © 2026 Serenity. All Rights Reserved