docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class ServiceObserver<T>

    Helper class to be notified when a service is initialized

    Inheritance
    object
    ServiceObserver<T>
    Implements
    IDisposable
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Unity.Services.Core
    Assembly: Unity.Services.Core.dll
    Syntax
    public class ServiceObserver<T> : IDisposable
    Type Parameters
    Name Description
    T

    The service to be observed

    Constructors

    ServiceObserver()

    Create an observer for a specific service interface to be notified when a service is initialized. This observes the global service registry.

    Declaration
    public ServiceObserver()

    ServiceObserver(IUnityServices)

    Create an observer for a specific service interface to be notified when a service is initialized

    Declaration
    public ServiceObserver(IUnityServices registry)
    Parameters
    Type Name Description
    IUnityServices registry

    The service registry to observe

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown if the provided registry is invalid

    Properties

    Service

    Access to the service once initialized

    Declaration
    public T Service { get; }
    Property Value
    Type Description
    T

    Methods

    Dispose()

    Unregisters event and resets registry

    Declaration
    public void Dispose()

    Events

    Initialized

    Event raised once the service is initialized

    Declaration
    public event Action<T> Initialized
    Event Type
    Type Description
    Action<T>

    Implements

    IDisposable
    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)