RealDocs

FText::RegisterTextGenerator

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

Description

Registers a custom ITextGenerator factory so that FText instances backed by that generator type can be deserialized correctly.

Caveats & Gotchas

  • TypeID must be globally unique — a collision with an existing generator (including built-in ones) will assert in Debug builds and silently overwrite in Shipping. Use a plugin- or module-prefixed name to avoid conflicts.
  • Registration must happen before any FText with this generator type is deserialized. The ideal place is a module's StartupModule() function.

Signature

static CORE_API void RegisterTextGenerator( FName TypeID, FCreateTextGeneratorDelegate FactoryFunction )

Parameters

Name Type Description Default
TypeID FName Unique identifier for this generator type, used during serialization to reconstruct the generator.
FactoryFunction FCreateTextGeneratorDelegate Factory delegate that creates a new instance of the ITextGenerator implementation.

Return Type

void

Example

Register a custom generator in StartupModule C++
void FMyModule::StartupModule()
{
    FText::RegisterTextGenerator(
        FName(TEXT("MyModule_CustomGenerator")),
        FCreateTextGeneratorDelegate::CreateStatic(&UMyTextGenerator::Create)
    );
}

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.