RealDocs

UTextBlock

class UMG Blueprint Since 4.5
#include "Components/TextBlock.h"

Description

A static text display widget. Shows FText content with configurable font, color, shadow, and wrapping. Bind it to a dynamic delegate or call SetText() to update at runtime.

Signature

class UTextBlock : public UTextLayoutWidget

Caveats & Gotchas

  • Prefer FText over FString for all displayed text — FText supports localization, FString does not.
  • Direct property access (e.g. TextBlock->Text) was deprecated in UE 5.1. Use SetText()/GetText() accessors instead.
  • For frequently-updated text (e.g. timer, ammo counter), use a FieldNotify binding to avoid polling every tick.

Example

Update text at runtime in C++ C++
// In your widget C++ class:
void UMyHUDWidget::UpdateAmmoDisplay(int32 Current, int32 Max)
{
    if (AmmoText)
    {
        AmmoText->SetText(FText::Format(
            LOCTEXT("AmmoFormat", "{0} / {1}"),
            Current, Max
        ));
    }
}

See Also

Tags

Version History

Introduced in: 4.5

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.