RealDocs

FText::GetEmpty

function Core Since unknown
#include "Internationalization/Text.h"
Access: public Specifiers: static

Description

Returns a reference to the statically-allocated empty FText singleton, avoiding heap allocation for the common case of an empty text value.

Caveats & Gotchas

  • Returns a const reference to a global singleton — do not store the reference itself, as it is valid for the lifetime of the program. Copy the returned value if you need a mutable FText.
  • Prefer FText::GetEmpty() over FText() when you explicitly mean "no text"; both are empty but GetEmpty() signals intent more clearly and is cheaper (no allocation).

Signature

static CORE_API const FText& GetEmpty()

Return Type

const FText&

Example

Use as a default/reset value C++
FText MyLabel = FText::GetEmpty();
if (MyLabel.IsEmpty())
{
    MyLabel = LOCTEXT("DefaultLabel", "Press to Start");
}

Tags

Version History

Introduced in: unknown

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.