logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class UnityTaskServices

    Unity-specific implementation of ITaskServices providing service registration and retrieval.
    Uses a type-based dictionary to store and access services during initialization tasks, supporting fluent registration and both safe and required service access patterns.

    Inheritance
    object
    UnityTaskServices
    Implements
    ITaskServices
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Serenity.InitializationPipeline.InterfaceAdapters
    Assembly: Serenity.UnityGlobal.InterfaceAdapters.dll
    Syntax
    public class UnityTaskServices : ITaskServices

    Constructors

    UnityTaskServices()

    Declaration
    public UnityTaskServices()

    Methods

    GetRequired<T>()

    Retrieves a required service of the specified type.

    Declaration
    public T GetRequired<T>()
    Returns
    Type Description
    T

    The service instance

    Type Parameters
    Name Description
    T

    The service type to retrieve

    Exceptions
    Type Condition
    InvalidOperationException

    Thrown when the service is not registered

    Register<T>(T)

    Registers a service instance for the specified type.

    Declaration
    public UnityTaskServices Register<T>(T instance)
    Parameters
    Type Name Description
    T instance

    The service instance to register

    Returns
    Type Description
    UnityTaskServices

    This UnityTaskServices instance for fluent chaining

    Type Parameters
    Name Description
    T

    The service type to register

    TryGet<T>(out T)

    Attempts to retrieve a service of the specified type.

    Declaration
    public bool TryGet<T>(out T service)
    Parameters
    Type Name Description
    T service

    When successful, contains the service instance; otherwise, the default value

    Returns
    Type Description
    bool

    True if the service was found and retrieved successfully; otherwise, false

    Type Parameters
    Name Description
    T

    The service type to retrieve

    Implements

    ITaskServices
    In this article
    © 2026 Serenity. All Rights Reserved