Subsystems

Engine- and world-scoped singletons that the engine creates on first use, initializes, and tears down in order.

Last updated Oct 26, 2026Edit this pageVersion 1.0.0

A subsystem is a managed singleton tied to the engine or to one world. Instead of a hand-written global with fragile teardown, you declare a class; the engine creates it the first time someone asks for it, roots it so the garbage collector never frees it, initializes it, and destroys it with its scope. This is Unreal's subsystem model.

Base classScopeReached throughLives
MEngineSubsystemThe engineGEngine->GetSubsystem<T>()From first use until engine shutdown
MWorldSubsystemOne worldworld->GetSubsystem<T>()From first use until the world is destroyed
MEngineSubsystem MWorldSubsystem

An engine subsystem

Derive from MEngineSubsystem and override Initialize and Deinitialize:

ScoreSubsystem.h
#include "Core/MSubsystem.h"

class MScoreSubsystem : public Mowo::MEngineSubsystem {
public:
	void Initialize() override {
		m_HighScore = 0;
	}

	void Deinitialize() override {
	}

	void Record(int32_t score) {
		if (score > m_HighScore) {
			m_HighScore = score;
		}
	}

	int32_t GetHighScore() const {
		return m_HighScore;
	}

private:
	int32_t m_HighScore = 0;
};

Reach it from anywhere the engine is alive:

C++
MScoreSubsystem* scores = GEngine->GetSubsystem<MScoreSubsystem>();
scores->Record(4200);

GEngine is null before Engine::Initialize and after Engine::Shutdown; guard code that can run outside a session. At shutdown every engine subsystem's Deinitialize runs in reverse order of creation.

Warning

The order in which subsystems initialize is not guaranteed. If one needs another, call GEngine->GetSubsystem<X>() from its Initialize; that creates X if it does not exist yet.

A world subsystem

Derive from MWorldSubsystem. Initialize receives the owning world:

SpawnDirector.h
#include "Core/MSubsystem.h"

class MSpawnDirector : public Mowo::MWorldSubsystem {
public:
	void Initialize(Mowo::MWorld* world) override {
		m_World = world;
	}

	void Deinitialize() override {
		m_World = nullptr;
	}

private:
	Mowo::MWorld* m_World = nullptr;
};
C++
MSpawnDirector* director = world->GetSubsystem<MSpawnDirector>();

MWorld::GetSubsystem A world subsystem is the right home for per-level state: spawn budgets, level-scoped managers, streaming bookkeeping. An engine subsystem holds state that outlives any one world.

When to use one

Use a subsystem for shared, long-lived state with a clear setup and teardown that many systems need. Keep per-actor state on the actor and per-frame work in ticks. Prefer a subsystem over a raw singleton (the engine owns the lifetime and the teardown order) and over passing a manager pointer through every call.

Engine sources

This page describes behavior implemented in these files of the engine repository, checked against commit 5922e6e5e.

  • Engine/Source/Runtime/Core/Public/Core/MSubsystem.h
  • Engine/Source/Runtime/Game/Public/Game/MWorld.h

Page feedback

Was this page helpful?