Choose your operating system:
Windows
macOS
Linux
Module |
|
Header |
/Engine/Source/Runtime/Engine/Public/Subsystems/Subsystem.h |
Include |
#include "Subsystems/Subsystem.h" |
class USubsystem : public UObject
Subsystems are auto instanced classes that share the lifetime of certain engine constructs
Currently supported Subsystem lifetimes are: Engine -> inherit UEngineSubsystem Editor -> inherit UEditorSubsystem GameInstance -> inherit UGameInstanceSubsystem World -> inherit UWorldSubsystem LocalPlayer -> inherit ULocalPlayerSubsystem
Normal Example: class UMySystem : public UGameInstanceSubsystem Which can be accessed by: UGameInstance* GameInstance = ...; UMySystem* MySystem = GameInstance->GetSubsystem<UMySystem>();
or the following if you need protection from a null GameInstance UGameInstance* GameInstance = ...; UMyGameSubsystem* MySubsystem = UGameInstance::GetSubsystem<MyGameSubsystem>(GameInstance);
You can get also define interfaces that can have multiple implementations. Interface Example : MySystemInterface With 2 concrete derivative classes: MyA : public MySystemInterface MyB : public MySystemInterface
Which can be accessed by: UGameInstance* GameInstance = ...; const TArray<UMyGameSubsystem*>& MySubsystems = GameInstance->GetSubsystemArray<MyGameSubsystem>();
Name | Description | |
---|---|---|
|
USubsystem() |
Name | Description | ||
---|---|---|---|
|
Deinitialize() |
Implement this for deinitialization of instances of the system |
|
|
Initialize ( |
Implement this for initialization of instances of the system |
|
|
ShouldCreateSubsystem ( |
Override to control if the Subsystem should be created at all. |
Name | Description | ||
---|---|---|---|
|
GetFunctionCallspace |
Overridden to check global network context |