UViewportStatsSubsystem

The Viewport Stats Subsystem offers the ability to add messages to the current viewport such as "LIGHTING NEEDS TO BE REBUILT" and "BLUEPRINT COMPILE ERROR".

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

Engine

Header

/Engine/Source/Runtime/Engine/Classes/Engine/ViewportStatsSubsystem.h

Include

#include "Engine/ViewportStatsSubsystem.h"

Syntax

class UViewportStatsSubsystem : public UWorldSubsystem

Remarks

The Viewport Stats Subsystem offers the ability to add messages to the current viewport such as "LIGHTING NEEDS TO BE REBUILT" and "BLUEPRINT COMPILE ERROR".

Example usage:

if (UViewportStatsSubsystem* ViewportSubsystem = GetWorld()->GetSubsystem<UViewportStatsSubsystem>()) { Bind a member function delegate to the subsystem... FViewportDisplayCallback Callback; Callback.BindDynamic(this, &UCustomClass::DisplayViewportMessage); ViewportSubsystem->AddDisplayDelegate(Callback);

... or use inline lambda functions ViewportSubsystem->AddDisplayDelegate([]([FText](API\Runtime\Core\Internationalization\FText)& OutText, FLinearColor& OutColor) { Some kind of state management OutText = NSLOCTEXT("FooNamespace", "Blarg", "Display message here"); OutColor = FLinearColor::Red; return bShouldDisplay; }); }

Variables

Name Description

Protected variable

TArray< FViewpo...

 

DisplayDelegates

Array of delegates that will be displayed if they return true when evaluated

Protected variable

TArray< TShared...

 

UniqueDisplayMessages

Array of unique one-off timed messages to display each frame no matter what

Functions

Name Description

Public function

int32

 

AddDisplayDelegate

(
    FViewportDisplayCallback const& De...
)

Add a dynamic delegate to the display subsystem.

Public function

int32

 

AddDisplayDelegate

(
    FShouldDisplayFunc&& Callback
)

Add a callback function to the display subsystem.

Public function

void

 

AddTimedDisplay

(
    FText Text,
    FLinearColor Color,
    float Duration
)

Add a message to be displayed on the viewport of this world

Public function

void

 

Draw

(
    FViewport* Viewport,
    FCanvas* Canvas,
    UCanvas* CanvasObject,
    float MessageStartY
)

Draw the messages in this subsystem to the given viewport

Public function

void

 

RemoveDisplayDelegate

(
    const int32 IndexToRemove
)

Remove a callback function from the display subsystem

Overridden from USubsystem

Name Description

Protected function Virtual

void

 

Deinitialize()

Implement this for deinitialization of instances of the system

Classes

Name

Description

Protected struct

FUniqueDisplayData

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