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:
UScriptWorldSubsystem
for world subsystemsUScriptGameInstanceSubsystem
for game instance subsystemsUScriptLocalPlayerSubsystem
for local player subsystemsUScriptEditorSubsystem
for editor subsystemsUScriptEngineSubsystem
for engine subsystems
For example, a scripted world subsystem might look like this:
Any UFUNCTION
s 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
APlayerController
when retrieving a local player subsystem.