Subsystems🔗
Subsystems are one of unreal's ways to collect common functionality into easily accessible singletons. See the Unreal Documentation on Programming Subsystems for more details.
Using a Subsystem🔗
Subsystems in script can be retrieved by using USubsystemClass::Get().
Note: Many subsystems are Editor Subsystems and cannot be used in packaged games.
Make sure you only use editor subsystems inside Editor-Only Script.
Creating a Subsystem🔗
To allow creating subsystems in script, helper base classes are available to inherit from that expose overridable functions.
These are:
UScriptWorldSubsystemfor world subsystemsUScriptGameInstanceSubsystemfor game instance subsystemsUScriptLocalPlayerSubsystemfor local player subsystemsUScriptEditorSubsystemfor editor subsystemsUScriptEngineSubsystemfor engine subsystems
For example, a scripted world subsystem might look like this:
Any UFUNCTIONs you've declared can also be accessed from blueprint on your subsystem:

Local Player Subsystems🔗
In case of local player subsystems, you need to pass which ULocalPlayer to retrieve the subsystem for into the ::Get() function:
Note: It is also possible to directly pass an
APlayerControllerwhen retrieving a local player subsystem.