Replacing and switching off subsystems
The Pulse plugins keep their runtime logic in subsystems (game instance, world, local player). Some of them are made to be changed by your project:
- Overridable: you replace the subsystem with a class of your own that derives from it, for rules of your own (how the cursor follows the menus, how factions relate, how construction progresses). The plugin creates your class instead of its own, and every caller gets yours.
- Switchable: your project does not need the subsystem (the UI of a plugin your game replaces, voice, chat) and turns it off in Project Settings > Pulse > Foundation > Subsystems > Disabled Subsystems.
A subsystem can be both. Subsystems other plugins rely on (message bus, clock, requests, definitions, the UI host) are neither; they stay on and say so in their class comment. Each plugin lists its overridable and switchable subsystems in a section of this name on its docs.
Subsystems of Pulse Foundation
| Subsystem | Kind | What it is for |
|---|---|---|
UPulsePlayerInputManager (local player, PulseFoundationUI) | Overridable | Own rules for cursor and input mode: override ResolveContexts (the contexts top first come from GetInputContexts) and ApplyContexts (sets cursor, input mode, focus on GetInputPlayerController). Not switchable: every UI of the Pulse plugins adds its input contexts here; turn it off with Enable Player Input Manager instead. |
UPulseAccessibilitySubsystem (local player, PulseFoundationUI) | Switchable | Applies the display options of the accessibility settings. Switch it off when your game applies them itself; Register Accessibility Settings off also removes the settings tab. |
UPulsePropLevelSubsystem (world, PulseVisual) | Overridable | Picks the distance levels of all Pulse props of a world (level manager): override GatherViews for other viewpoints (a spectator, a drone), GatherServerViews for other server views of the live band, Register for own filters. Not switchable: props with levels rely on it (without it they stay on their nearest level). On a dedicated server it picks no levels and runs only the live band around the player pawns; not created there with bServerPawnViews off. |
Switching a subsystem off
Add the class to Disabled Subsystems (DefaultGame.ini):
[/Script/PulseFoundation.PulseFoundationSettings]
+DisabledSubsystems=/Script/PulseFoundationUI.PulseAccessibilitySubsystem
- An entry also turns off the classes derived from it. An entry with only a derived class turns that class off and brings the base back (useful to test without your replacement).
- Only subsystems marked switchable read the list. The settings warn in the editor about an entry that is not switchable or does not exist, when you edit the list and again in the log each time Play in Editor starts; such an entry does nothing.
- The list applies to game instances, worlds and local players made afterwards (the next PIE session, the next level).
- Every caller of a switchable subsystem handles its absence: Get … Subsystem gives None, C++ gets
nullptr, and the functions of the plugin that need it do nothing. Check for it in your own Blueprints too. - Entries that are not loaded are not loaded by the check: a class that is not in memory is never created.
- A subsystem that only serves another one goes off with it (the plugin docs name these).
Replacing a subsystem
Derive from the subsystem in C++ and override its virtual functions. Your class answers true in ShouldCreateSubsystem (the default through Super), so the base is not created:
// MyInputManager.h (a module of your game, loading phase Default or earlier)
UCLASS()
class UMyInputManager : public UPulsePlayerInputManager
{
GENERATED_BODY()
protected:
virtual FPulseResolvedInputState ResolveContexts() const override
{
FPulseResolvedInputState state = Super::ResolveContexts();
// Gamepad players never see the cursor
if (IsUsingGamepad())
state.bShowCursor = false;
return state;
}
bool IsUsingGamepad() const;
};
- Callers keep asking for the base:
GetSubsystem<UPulsePlayerInputManager>(), Get … Subsystem of the base and the plugin’s ownGetfunctions find your class. - Your class may decide when it replaces the base:
return Super::ShouldCreateSubsystem(Outer) && MyCondition;. Where it answers false, the base is created. The conditions of the base (world type, net mode, its settings) apply to your class too, because it callsSuper. - Only loaded classes count, like for the engine: put the class in a module with the loading phase Default or earlier. A module loaded later (after the collection exists) may leave both classes running for a moment.
- The Pulse subsystems are not Blueprintable: write the replacement in C++.
- Hot Reload and Live Coding: replaced classes from a reload never count. A replacement added by Hot Reload takes effect with the next world, game instance or local player.
For plugin authors
Subsystems/PulseSubsystems.h (module PulseFoundation) has the helper every Pulse subsystem uses:
UCLASS(meta = (PulseSubsystem = "Both"))
class UMyPluginSubsystem : public UGameInstanceSubsystem { ... };
bool UMyPluginSubsystem::ShouldCreateSubsystem(UObject* Outer) const
{
// Own conditions first, the helper last
return Super::ShouldCreateSubsystem(Outer) && Pulse::MyPlugin::GetSettings()->bEnableMyPlugin
&& Pulse::Subsystems::ShouldCreate(this, Outer, EPulseSubsystemTraits::Both);
}
| Function | Does |
|---|---|
Pulse::Subsystems::ShouldCreate(Subsystem, Outer, Traits) | EPulseSubsystemTraits::Overridable: false when a class derived from it at any depth answers true for the same outer (asked through its class default object; abstract classes are not asked; deprecated classes and classes replaced by a reload never count). Switchable: false when the class or a parent is in Disabled Subsystems. Both: both. Logs each decision once per class and outer type (LogPulseFoundation). |
Pulse::Subsystems::IsDisabled(Class) | Whether the list turns a class off. A subsystem that only serves another asks with that one’s class. |
Pulse::Subsystems::FindCreatedClass(Class, Outer) | The class created for an outer instead of a class: itself, its replacement or none. Ask it before GetSubsystem while subsystems initialize: asking for a class that is not created trips an engine ensure there. |
Pulse::Subsystems::InitializeDependency<T>(Collection) | Initializes the class FindCreatedClass names, T or its replacement. In Unreal Engine 5.8 the engine’s Collection.InitializeDependency<T>() also gives the replacement (a spec checks this), so both work; Pulse plugins use this one for overridable subsystems, so they do not depend on how an engine version resolves a replaced class. |
Pulse::Subsystems::ValidateDisabledSubsystems(Classes, OutWarnings) | Editor: warnings for entries that are not switchable or do not exist (the settings call it). |
Pulse::Subsystems::FScopedDisabledSubsystems | Specs: replaces the list while it lives (empty by default). The list of the newest living scope applies, also when scopes end out of order; the last one restores the list of the project. Pulse::Testing::FTestWorld sets an empty list while the world lives, unless a spec set one before Create. |
Rules for the meta and the code:
- Mark each overridable or switchable class with
UCLASS(meta = (PulseSubsystem = "Overridable" | "Switchable" | "Both")). The meta is read by the settings check in the editor only (games have no metadata); the traits passed toShouldCreatedecide at runtime, and no runtime code reads the meta. A derived class inherits the meta of its parent. The specPulseFoundation.Subsystemschecks in the editor that every marked class passes the traits of its meta. - Pass only the traits the subsystem allows: an overridable-only subsystem passes
Overridable, so the list never turns it off (its callers do not expectnullptr). - Every caller of a switchable subsystem handles
nullptr. - An overridable subsystem keeps its logic in virtual functions and says in its class comment which to override.
Debugging
- The log says once per class and outer type: “X is replaced by Y for LocalPlayer.” or “X is switched off for World by Project Settings > Pulse > Foundation > Disabled Subsystems.” (
LogPulseFoundation, Log). - The Pulse Debugger and
PulseDebugDump Subsystemsshow the snapshot Subsystems of each game world: the replaced and switched off subsystems and the entries of the list (entries that are not loaded as warnings).