{"id":18782020,"url":"https://github.com/sleeptightansic/actorsingleton","last_synced_at":"2026-01-05T00:12:57.100Z","repository":{"id":222284680,"uuid":"756807940","full_name":"sleeptightAnsiC/ActorSingleton","owner":"sleeptightAnsiC","description":"Small code plugin for Unreal 5 which adds inheritable Actor class that can be spawned only once within same World context.","archived":false,"fork":false,"pushed_at":"2024-05-23T14:37:39.000Z","size":36,"stargazers_count":3,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-27T11:11:38.890Z","etag":null,"topics":["actor","cpp","plugin","singleton","ue5","ue5-plugin","unreal-engine-5"],"latest_commit_sha":null,"homepage":"","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/sleeptightAnsiC.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-02-13T10:53:27.000Z","updated_at":"2024-10-25T08:32:29.000Z","dependencies_parsed_at":"2024-11-07T20:37:14.918Z","dependency_job_id":"5958a66b-707b-44b3-bec9-229ffb8abf83","html_url":"https://github.com/sleeptightAnsiC/ActorSingleton","commit_stats":null,"previous_names":["sleeptightansic/actorsingleton"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sleeptightAnsiC%2FActorSingleton","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sleeptightAnsiC%2FActorSingleton/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sleeptightAnsiC%2FActorSingleton/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sleeptightAnsiC%2FActorSingleton/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sleeptightAnsiC","download_url":"https://codeload.github.com/sleeptightAnsiC/ActorSingleton/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244947011,"owners_count":20536545,"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":["actor","cpp","plugin","singleton","ue5","ue5-plugin","unreal-engine-5"],"created_at":"2024-11-07T20:34:35.746Z","updated_at":"2026-01-05T00:12:57.073Z","avatar_url":"https://github.com/sleeptightAnsiC.png","language":"C++","readme":"# ActorSingleton\n\nTiny UE5 plugin that adds [AActorSingleton](https://github.com/sleeptightAnsiC/ActorSingleton/blob/main/Source/ActorSingleton/Public/ActorSingleton.h#L35) class.\n\nInstall like every other plugin, by cloning into project's `Plugins` directory.\n\nFor context see the information below or read the source code.\n\n## About\n\nThis plugin has been created for my personal use, but I decided to publish it, since it has proven to be somehow usefull.\n\nImagine the following case: you need an [UObject](https://docs.unrealengine.com/5.3/en-US/API/Runtime/CoreUObject/UObject/UObject/) that lives within [UWorld](https://docs.unrealengine.com/5.3/en-US/API/Runtime/Engine/Engine/UWorld/), there can be only one spawned instance of said object and it must be accessible from the [Editor's Level Viewport](https://docs.unrealengine.com/5.3/en-US/editor-viewports-in-unreal-engine/). Basically, something like \"[Singleton](https://en.wikipedia.org/wiki/Singleton_pattern)\".\n\nSo what options do we have? Unreal Engine has [few ways of creating singletons](https://benui.ca/unreal/subsystem-singleton/), the best out of them is creating a class derived from [USubsytem](https://docs.unrealengine.com/5.3/en-US/API/Runtime/Engine/Subsystems/USubsystem/). The one that suits most of our needs is [UWorldSubsystem](https://docs.unrealengine.com/5.3/en-US/API/Runtime/Engine/Subsystems/UWorldSubsystem/), but said class isn't spawnable and won't appear in the Level Viewport, so it doesn't fully fit our needs.\n\nThe other option would be creating an [AActor](https://docs.unrealengine.com/5.3/en-US/API/Runtime/Engine/GameFramework/AActor/). Actors are easily accessible from Level Viewport. However, how do we ensure that there is only one spawned instance of said Actor?...\n\n...and this is why this plugin exists. It introduces [AActorSingleton](https://github.com/sleeptightAnsiC/ActorSingleton/blob/main/Source/ActorSingleton/Public/ActorSingleton.h#L35) class. If you try to spawn multiple instances of said class, it will only allow to spawn the first instance and will automaticly destroy the rest.\n\n## Usage\n\nDerive from [AActorSingleton](https://github.com/sleeptightAnsiC/ActorSingleton/blob/main/Source/ActorSingleton/Public/ActorSingleton.h#L35) and make sure that [ActorSingleton::IsFinalParent](https://github.com/sleeptightAnsiC/ActorSingleton/blob/main/Source/ActorSingleton/Public/ActorSingleton.h#L49) returns `true` for your class.\n\nWhenever you try to spawn a duplicate instace, you will get a meaningfull error about it. If you try to do this by placing an Actor to the Level Viewport you will even get a clear popup message:\n\n![image](https://github.com/sleeptightAnsiC/ActorSingleton/assets/91839286/ef8cd4f1-9a0d-47e3-9522-77eb1351e80e)\n\n#### Tested on Linux with UE 5.3.2 and clang\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsleeptightansic%2Factorsingleton","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsleeptightansic%2Factorsingleton","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsleeptightansic%2Factorsingleton/lists"}