USubsystem

Subsystems are auto instanced classes that share the lifetime of certain engine constructs

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

Engine

Header

/Engine/Source/Runtime/Engine/Public/Subsystems/Subsystem.h

Include

#include "Subsystems/Subsystem.h"

Syntax

class USubsystem : public UObject

Remarks

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>();

Constructors

Name Description

Public function

USubsystem()

Functions

Name Description

Public function Virtual

void

 

Deinitialize()

Implement this for deinitialization of instances of the system

Public function Virtual

void

 

Initialize

(
    FSubsystemCollectionBase& Collecti...
)

Implement this for initialization of instances of the system

Public function Virtual Const

bool

 

ShouldCreateSubsystem

(
    UObject* Outer
)

Override to control if the Subsystem should be created at all.

Overridden from UObject

Name Description

Public function Virtual

int32

 

GetFunctionCallspace

(
    UFunction* Function,
    FFrame* Stack
)

Overridden to check global network context

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss