docs.unity3d.com
    Show / Hide Table of Contents

    Class CoreRegistry

    A container to store all available IInitializablePackage and IServiceComponent in the project.

    Inheritance
    Object
    CoreRegistry
    Namespace: Unity.Services.Core.Internal
    Syntax
    public sealed class CoreRegistry

    Properties

    Instance

    Get the only registry of this project.

    Declaration
    public static CoreRegistry Instance { get; }
    Property Value
    Type Description
    CoreRegistry

    Methods

    GetServiceComponent<TComponent>()

    Get the instance of the given IServiceComponent type.

    Declaration
    public TComponent GetServiceComponent<TComponent>()
        where TComponent : IServiceComponent
    Returns
    Type Description
    TComponent

    Return the instance of the given IServiceComponent type if it has been registered; throws an exception otherwise.

    Type Parameters
    Name Description
    TComponent

    The type of IServiceComponent to get.

    Exceptions
    Type Condition
    KeyNotFoundException

    Thrown if the requested type of TComponent hasn't been registered yet.

    RegisterPackage<TPackage>(TPackage)

    Store the given package in this registry.

    Declaration
    public CoreRegistration RegisterPackage<TPackage>([NotNull] TPackage package)
        where TPackage : IInitializablePackage
    Parameters
    Type Name Description
    TPackage package

    The service package instance to register.

    Returns
    Type Description
    CoreRegistration

    Return a handle to the registered package to define its dependencies and provided components.

    Type Parameters
    Name Description
    TPackage

    The type of IInitializablePackage to register.

    RegisterServiceComponent<TComponent>(TComponent)

    Store the given component in this registry.

    Declaration
    public void RegisterServiceComponent<TComponent>([NotNull] TComponent component)
        where TComponent : IServiceComponent
    Parameters
    Type Name Description
    TComponent component

    The component instance to register.

    Type Parameters
    Name Description
    TComponent

    The type of IServiceComponent to register.

    Back to top
    Terms of use
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023