{"id":18238357,"url":"https://github.com/umodules/uservice","last_synced_at":"2026-04-30T14:37:04.774Z","repository":{"id":259287427,"uuid":"877463708","full_name":"UModules/UService","owner":"UModules","description":"A lightweight service locator utility for Unity to register, manage, and retrieve services, including MonoBehaviour.","archived":false,"fork":false,"pushed_at":"2024-10-23T18:50:15.000Z","size":13,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-02-14T12:36:22.904Z","etag":null,"topics":["dependency-injection","monobehaviour","service-locator","unity"],"latest_commit_sha":null,"homepage":"https://useffarahmand.com/","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/UModules.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-23T17:35:38.000Z","updated_at":"2024-10-24T08:52:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"a758857f-e089-45de-ab0e-476eb4f01def","html_url":"https://github.com/UModules/UService","commit_stats":null,"previous_names":["umodules/uservice"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UModules%2FUService","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UModules%2FUService/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UModules%2FUService/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UModules%2FUService/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/UModules","download_url":"https://codeload.github.com/UModules/UService/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247878023,"owners_count":21011158,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dependency-injection","monobehaviour","service-locator","unity"],"created_at":"2024-11-05T03:05:16.494Z","updated_at":"2026-04-30T14:37:04.730Z","avatar_url":"https://github.com/UModules.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# UService 🚀\nUService is a lightweight service locator utility for Unity, designed to manage and retrieve service instances efficiently. The tool allows for the easy registration, retrieval, and management of services, including `MonoBehaviour` services which must be attached to `GameObject`.\n\n## Features ✨\n* 🔧 **Service Registration:** Register services either by providing an instance or through lazy instantiation.\n* 🎮 **MonoBehaviour Management:** Handles `MonoBehaviour` services by attaching them to Unity `GameObjects`.\n* 🔍 **Service Retrieval:** Retrieve registered services with lazy instantiation.\n* 🧹 **Unregister Services:** Clean up services when they are no longer needed.\n\n## Installation 📦\n* Clone or download the repository.\n* Add the `ServiceLocator` script to your Unity project.\n* Make sure the namespace `UService` is referenced in your code.\n  \n## Usage 🚀\n### Registering a Service 🛠️\nTo register an existing instance of a service:\n```C#\nServiceLocator.RegisterService\u003cIService\u003e(myServiceInstance);\n```\nFor lazy instantiation:\n```C#\nServiceLocator.RegisterService\u003cIService\u003e();\n```\n\n### Retrieving a Service 🔍\n```C#\nvar myService = ServiceLocator.GetService\u003cIService\u003e();\n```\n\n### Unregistering a Service 🧹\n```C#\nServiceLocator.UnregisterService\u003cIService\u003e();\n```\n## Example 💡\nHere is a simple usage example:\n```C#\n// Register a new service\nServiceLocator.RegisterService\u003cMyService\u003e();\n\n// Retrieve the registered service\nMyService service = ServiceLocator.GetService\u003cMyService\u003e();\n\n// Unregister the service when it's no longer needed\nServiceLocator.UnregisterService\u003cMyService\u003e();\n```\n\n## License 📄\nThis project is licensed under the MIT License. See the [LICENSE](https://github.com/UModules/UService/blob/main/LICENSE) file for details.\n\n## Contributing 🤝\nContributions are welcome! Please submit a pull request or open an issue for discussion.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fumodules%2Fuservice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fumodules%2Fuservice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fumodules%2Fuservice/lists"}