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 ServicesContainerRemarks
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:
Loads the
ServicesContainertype fromUnityEditor.CoreModuleGets the
instancestatic property (the singleton)Caches the
Resolvemethod for generic service resolution
Service Resolution
The private Resolve() method:
Loads the requested interface type by name from
UnityEditor.CoreModuleCreates a generic
Resolve<T>()method for that interfaceInvokes 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
Not an InternalProxy subclass Unlike all other types in this folder, ServicesContainer is a plain static class using manual reflection. It directly accesses typeof(UnityEditor.Editor).Assembly to locate internal types.
Reflection-based — may break on Unity version changes The container singleton, Resolve method, and IPackageDatabase interface are all internal Unity types. Their names or locations may change between Unity versions.
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