> For the complete documentation index, see [llms.txt](https://docs.msquared.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.msquared.io/creation/unreal-development/features-and-tutorials/singletons.md).

# Singletons

{% hint style="success" %}
verified: 2025-11-20 version: v39
{% endhint %}

A singleton is a server-authoritative `MorpheusActor` which is spawned exactly once, when the server starts up. A singleton can [replicate](/creation/unreal-development/getting-started/networking/replicated-properties.md) data to game clients, and game clients can send data to the server with server [RPCs](/creation/unreal-development/getting-started/networking/morpheus-rpcs.md).

Singletons are useful for the common case where you want to put a single easily-accessed object in charge of some behaviour. If no replication is required, you could handle this with server-only logic on a subsystem. However, if you want to communicate between the client and server, you need a `MorpheusActor`, so you need to use a singleton.

## How are they set up? <a href="#how-are-they-set-up" id="how-are-they-set-up"></a>

To make a singleton, create a new blueprint class from a `MorpheusActor`.

In the World Settings panel, locate the `Singletons` section, and add your new class to the `Additional Singletons` array.

<figure><img src="/files/OAMl5QK7PwWmrav1UNaV" alt=""><figcaption><p>Additional Singletons</p></figcaption></figure>

If you want this singleton behaviour but for non-Morpheus Actors, use the `Non Morpheus Singletons` array. Disconnected instances of your class will be spawned on the server and all clients. (This is similar to a subsystem, but preferable if you want control over which levels the object is present in.)

<figure><img src="/files/iG3nCEyrXlEZ7H3PsW9M" alt=""><figcaption><p>Non Morpheus Singletons</p></figcaption></figure>

{% hint style="warning" %}
Singletons do not spawn automatically during automated tests. Manually spawn the required Singletons when creating automated tests that rely on them.
{% endhint %}

## How to access your singleton

* The easiest way to get your singleton actor is using the `GetActorOfClass` method.
  * This will fail (return null) if called before the singleton has been spawned.
* To defer until your singleton is available, you can use the bootflow subsystem's function `HandleCommonActorsSpawned` in your actor's `BeginPlay`/`MorpheusBeginPlay`:

<figure><img src="/files/ZAW1qWJiE5dHl3XOyy0X" alt=""><figcaption><p>This example will cache the singleton of type <code>BPM_VendingMachineManager</code> once it has been spawned. Other bootflow steps after <code>HandleCommonActorsSpawned</code> would also work here, e.g. <code>HandleBootflowFinished</code>.</p></figcaption></figure>

* Alternatively, you can use the global function `GetSingletonOnceAvailable`, specifying the `SingletonClass`.
  * The result will be a base `Actor`, so you will need to cast to the class you need.

<figure><img src="/files/K6dWwHLcEQER0JTFL1n3" alt=""><figcaption></figcaption></figure>
