# ScottDunbar.io - SD Singleton Util 

**URL:** <https://forums.unrealengine.com/t/scottdunbar-io-sd-singleton-util/2501802>\
**Category:** Product Discussion\
**Tags:** fab\
**Created:** [May 11, 2025, 2:05am UTC](https://forums.unrealengine.com/t/scottdunbar-io-sd-singleton-util/2501802 "2025-05-11T02:05:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ScottDunbar.io](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/scottdunbar.io/32/1018697_2.png) [@ScottDunbar.io](https://forums.unrealengine.com/u/ScottDunbar.io)\
**Post date:** [May 11, 2025, 2:05am UTC](https://forums.unrealengine.com/t/scottdunbar-io-sd-singleton-util/2501802/1 "2025-05-11T02:05:04Z")

</div>

##### SD Singleton Util - Destroyer of hard references and "get actor of class"

A blueprint-exposed, C++ only, singleton utility **plugin** for **Unreal Engine** , designed to cache and retrieve singleton instances of actors, interfaces, and global objects.

#### See it in action here (GIF on front page) : [https://github.com/scott-hf/SingletonUtil](https://github.com/scott-hf/SingletonUtil)

#### TLDR

- Stop calling "get actor of class" and caching it as a variable

- Remove hard references between blueprints

#### 

#### Intent

- De-couple more, cache easier, and remove clutter from variables in your blueprints - while remaining performant

- Call singleton functions for any actor, component, or interface

- For actors and components, auto-create the singleton class if it doesn't exist

#### 

#### Notes

- All C++, nothing in the content folder

- All functions exposed to blueprint. Use it in C++ or blueprint - your choice

- The two most commonly used functions are simplified and expose via blueprint function library. To see all functions, retrieve the subsystem.

#### Features

- Get Singleton Actor: Retrieve or create a singleton instance of an actor.

- Get Singleton Interface: Retrieve a singleton instance of an interface class.

- Global UObject Registry: Register and retrieve global UObjects with optional identifiers.

- Derived Class Caching: Efficiently cache derived classes for retrieval.

- Debug Tools: Inspect the current state of singleton caches for actors and objects.

## Installation

1. Clone or download this repository into your project's `Plugins` folder.

2. Enable the **Singleton Util Plugin** in your project's plugin settings.

#### Usage

### 1. Get Singleton Actor

Retrieve a singleton actor within the current world context.

- `WorldContextObject`: Reference to the current world.

- `MyActorClass`: The actor class to retrieve as a singleton.

- `bCreateIfMissing`: If `true`, creates a new instance if none exists.

### 2. Get Singleton Interface

Retrieve a singleton instance of a specific interface.

- `WorldContextObject`: Reference to the current world.

- `MyInterfaceClass`: Interface class to retrieve as a singleton.

- `OutObject`: Receives the object implementing the interface.

### 3. Register and Retrieve Global Objects

Register a global object to make it easily accessible across contexts.

Retrieve a global object by class and optional identifier.

### 4. Advanced Search Parameters

Use `FSD_SingletonSearchParams` for refined search criteria for finding interface singleton objects, such as filtering by object type, name, or actor-only objects.

## Debugging

- Object Cache Snapshot: Retrieve a snapshot of the current object cache.

- Actor Cache Snapshot: Inspect the current actor cache for debugging.

- Interface Cache Snapshot: Inspect the current interface cache for debugging.

## Available on github

If you'd like to build it yourself, you can find the cpp code available here:

[https://github.com/scott-hf/SingletonUtil](https://github.com/scott-hf/SingletonUtil)

## Special Thanks

Thank you to avigrail, who helped provided examples on how to declare interface specific return values, among other things

> **[SD Singleton Util](https://www.fab.com/listings/f531e623-d058-40ae-814f-46fa96766bfe)**
>
> SD Singleton Util - Destroyer of hard references and "get actor of class"A blueprint-exposed, C++ only, singleton utility plugin for Unreal Engine, designed to cache and retrieve singleton instances of actors, interfaces, and global objects.See it in...

---

<div class="post-metadata">

**Author:** ![myasga](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/myasga/32/1174424_2.png) [@myasga](https://forums.unrealengine.com/u/myasga)\
**Post date:** [May 11, 2025, 9:17am UTC](https://forums.unrealengine.com/t/scottdunbar-io-sd-singleton-util/2501802/2 "2025-05-11T09:17:34Z")

</div>

Thank you for Providing! 5.5 support any soon;)? All the best!

---

<div class="post-metadata">

**Author:** ![Jet\_Scalawag](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Jet\_Scalawag](https://forums.unrealengine.com/u/Jet_Scalawag)\
**Post date:** [May 11, 2025, 6:21pm UTC](https://forums.unrealengine.com/t/scottdunbar-io-sd-singleton-util/2501802/3 "2025-05-11T18:21:23Z")

</div>

Thanks! I rated this gem 5.0. Hopefully this will be maintained across future versions of Unreal Engine!

---

<div class="post-metadata">

**Author:** ![Dobrx](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Dobrx](https://forums.unrealengine.com/u/Dobrx)\
**Post date:** [May 31, 2025, 2:06am UTC](https://forums.unrealengine.com/t/scottdunbar-io-sd-singleton-util/2501802/4 "2025-05-31T02:06:32Z")

</div>

+1 to this, would love 5.5 support! Also, I’m a little confused on what the get Singleton interface does? Like I might be dumb but I thought interfaces were just ways to modularly call functions on actors without having to have a hard ref to them so I’m not sure how you would “get” an interface itself
