Service Locator
The ServiceLocator
class provides a way to manage services in your Unity project. It handles the registration, retrieval, and removal of services, supporting both MonoBehaviour and non-MonoBehaviour types. This pattern is useful for dependency management, allowing services to be loosely coupled while remaining accessible throughout the project.
Usage
Register
Register with custom Type
Retrieve
Retrieve Silent
Returns null instead of throwing an error.
Remove
ServiceLocatorRegisterMono
Register/Unregister services on Awake/OnDestroy.
Last updated