unreal.ViewportStatsSubsystem
¶
- class unreal.ViewportStatsSubsystem(outer: Object | None = None, name: Name | str = 'None')¶
Bases:
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) –
- Return type:
int32
- add_timed_display(text, color=[1.000000, 1.000000, 1.000000, 1.000000], duration=0.000000, display_offset=[0.000000, 0.000000]) 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
display_offset (Vector2D) – A position offset that the message should use when displayed.