{"id":24857396,"url":"https://github.com/pspkurara/singleton","last_synced_at":"2026-05-02T13:34:42.969Z","repository":{"id":217430130,"uuid":"533651855","full_name":"pspkurara/singleton","owner":"pspkurara","description":"Supports Unity's simple Singleton Behavior.","archived":false,"fork":false,"pushed_at":"2022-09-21T13:02:35.000Z","size":171,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-26T15:54:51.834Z","etag":null,"topics":["simple","singleton","unity"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pspkurara.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2022-09-07T07:18:14.000Z","updated_at":"2023-03-21T20:37:39.000Z","dependencies_parsed_at":"2024-01-16T11:53:52.696Z","dependency_job_id":null,"html_url":"https://github.com/pspkurara/singleton","commit_stats":null,"previous_names":["pspkurara/singleton"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/pspkurara/singleton","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pspkurara%2Fsingleton","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pspkurara%2Fsingleton/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pspkurara%2Fsingleton/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pspkurara%2Fsingleton/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pspkurara","download_url":"https://codeload.github.com/pspkurara/singleton/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pspkurara%2Fsingleton/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32536579,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-02T12:25:33.646Z","status":"ssl_error","status_checked_at":"2026-05-02T12:24:51.733Z","response_time":132,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["simple","singleton","unity"],"created_at":"2025-01-31T17:53:22.329Z","updated_at":"2026-05-02T13:34:42.938Z","avatar_url":"https://github.com/pspkurara.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"﻿# Singleton\r\n\r\nSupports Unity's simple Singleton Behavior.\r\n\r\n[![](https://img.shields.io/npm/v/com.pspkurara.singleton?label=openupm\u0026registry_uri=https://package.openupm.com)](https://openupm.com/packages/com.pspkurara.singleton/)\r\n[![](https://img.shields.io/github/v/release/pspkurara/singleton)](https://github.com/pspkurara/singleton/releases/)\r\n[![](https://img.shields.io/github/watchers/pspkurara/singleton?style=social)](https://github.com/pspkurara/external-selecion-state/subscription)\r\n\r\n## Usage\r\n\r\nCreate a script that extends SingletonMonoBehaviour.\r\nSpecify your own class name for the generic T.\r\n```\r\nusing UnityEngine;\r\nusing Pspkurara.Singleton;\r\n\r\npublic class SampleSingleton : SingletonMonoBehaviour\u003cSample\u003e\r\n{\r\n\tpublic int InspectorValue = 1;\r\n}\r\n\r\npublic class SampleAccess : MonoBehaviour\r\n{\r\n\tprivate void Start()\r\n\t{\r\n\t\tDebug.Log(SampleSingleton.instance.InspectorValue); // output: 1\r\n\t}\r\n}\r\n```\r\n\r\nIf you inherit anything with \"Internal\", only the inherited class has access to \".instance\".\r\nYou can implement static wrapper members to make them look like constants.\r\n```\r\nusing UnityEngine;\r\nusing Pspkurara.Singleton;\r\n\r\npublic class SampleSingleton : InternalSingletonMonoBehaviour\u003cSample\u003e\r\n{\r\n\t// raw value.\r\n\t[SerializeField]\r\n\tprivate int m_InspectorValue = 1;\r\n\t\r\n\t// static wrapper.\r\n\tpublic static int Value { get { return instance.m_InspectorValue; } }\r\n}\r\n\r\npublic class SampleAccess : MonoBehaviour\r\n{\r\n\tprivate void Start()\r\n\t{\r\n\t\tDebug.Log(SampleSingleton.Value); // output: 1\r\n\t}\r\n}\r\n```\r\n\r\n### Full API references\r\n* https://pspkurara.github.io/singleton/\r\n\r\n## Installation\r\n\r\n### Using OpenUPM\r\nGo to Unity's project folder on the command line and call:\r\n\r\n```\r\nopenupm add com.pspkurara.singleton\r\n```\r\n\r\n### Using Unity Package Manager (For Unity 2018.3 or later)\r\nFind the manifest.json file in the Packages folder of your project and edit it to look like this:\r\n\r\n```\r\n{\r\n  \"dependencies\": {\r\n    \"com.pspkurara.singleton\": \"https://github.com/pspkurara/singleton.git#upm\",\r\n    ...\r\n  },\r\n}\r\n```\r\n\r\n#### Requirement\r\nUnity 2018.1 or later\u003cbr\u003e\r\nMay work in Unity5, but unofficial.\r\n\r\n## License\r\n\r\n* [MIT](https://github.com/pspkurara/singleton/blob/master/Packages/Singleton/LICENSE.md)\r\n\r\n## Author\r\n\r\n* [pspkurara](https://github.com/pspkurara) \r\n[![](https://img.shields.io/twitter/follow/pspkurara.svg?label=Follow\u0026style=social)](https://twitter.com/intent/follow?screen_name=pspkurara) \r\n\r\n## See Also\r\n\r\n* GitHub page : https://github.com/pspkurara/singleton\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpspkurara%2Fsingleton","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpspkurara%2Fsingleton","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpspkurara%2Fsingleton/lists"}