ServicesContainer

Static entry point to Unity's internal dependency injection container. Resolves internal service interfaces to access Unity's private Package Manager API.

Definition

Namespace: Paragon.Editor.ThirdPartyPackageImporter.Internals Assembly: Paragon.Editor.dll

internal static class ServicesContainer

Remarks

ServicesContainer uses direct reflection (not the InternalProxy<T> pattern) to access Unity's internal UnityEditor.PackageManager.UI.Internal.ServicesContainer singleton. It provides a single public entry point: PackageDatabase.

Initialization

The static constructor:

  1. Loads the ServicesContainer type from UnityEditor.CoreModule

  2. Gets the instance static property (the singleton)

  3. Caches the Resolve method for generic service resolution

Service Resolution

The private Resolve() method:

  1. Loads the requested interface type by name from UnityEditor.CoreModule

  2. Creates a generic Resolve<T>() method for that interface

  3. Invokes it on the container singleton to get the service instance

The PackageDatabase property lazily resolves IPackageDatabase and wraps the result as a PackageDatabase proxy.

Properties

PackageDatabase

Lazily-resolved PackageDatabase proxy. Resolves UnityEditor.PackageManager.UI.Internal.IPackageDatabase from Unity's internal DI container on first access.

Common Pitfalls

circle-exclamation
circle-exclamation
circle-info

Lazy initialization for PackageDatabase The PackageDatabase property uses null-coalescing assignment (??=) and is only resolved once. Subsequent accesses return the cached proxy.

Examples

Typical Usage

See Also

  • PackageDatabase — The proxied service resolved by this container

  • Package — Returned by PackageDatabase.GetPackage()

Last updated