unreal.ViewportStatsSubsystem

class unreal.ViewportStatsSubsystem(outer=None, name='None')

Bases: unreal.WorldSubsystem

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& OutText, FLinearColor& OutColor) {

// Some kind of state management OutText = NSLOCTEXT(“FooNamespace”, “Blarg”, “Display message here”); OutColor = FLinearColor::Red; return bShouldDisplay;

});

}

C++ Source:

  • Module: Engine

  • File: ViewportStatsSubsystem.h

add_display_delegate(delegate)int32

Add a dynamic delegate to the display subsystem.

Parameters

delegate (ViewportDisplayCallback) –

Returns

Return type

int32

add_timed_display(text, color=[0.0, 0.0, 0.0, 0.0], duration=0.0)None

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

Parameters
  • text (Text) – The text to be displayed

  • color (LinearColor) – Color of the text to be displayed

  • duration (float) – How long the text will be on screen, if 0 then it will stay indefinitely

remove_display_delegate(index_to_remove)None

Remove a callback function from the display subsystem

Parameters

index_to_remove (int32) – The index in the DisplayDelegates array to remove. This is the value returned from AddDisplayDelegate.