Skip to content

World Text Letter Widget

Introduction

A letter displayed in the world text

Required Widgets

There is already a WorldTextLetterWidget_Implementation that you can use in your projects. But if you create your own instance of this widget, you need to add the following before you can compile:

Name Description Type
TextBlock The text block used to display the letter UTextBlock*

Optional Animations

You can add the following widgets to enable extra functionality:

Name Description
ShowAnimation The animation played when showing the letter
DestroyAnimation The animation played when destroying the letter

API Reference

Properties

Property Description Type Default Value
ShowAnimation The animation played when showing the letter UWidgetAnimation* nullptr
DestroyAnimation The animation played when destroying the letter UWidgetAnimation* nullptr
TypeDuration The time it takes to type the letter float 0.055f

Functions

Name Description Params Return
InitializeLetter Initialize the letter Word (UWorldTextWordWidget*)
The parent world text word widget

Letter (FString&)
The letter to display
UpdateNextLetter Update the reference to the next letter in the word Letter (UWorldTextLetterWidget*)
The next letter in the word
Show Show the letter Index (int)
The index of the letter in the word
Destroy Destroy the letter

Blueprint Usage

You can use the WorldTextLetterWidget using Blueprints by adding one of the following nodes:

  • Ultimate Starter Kit > Narrative > Initialize Letter
  • Ultimate Starter Kit > Narrative > Update Next Letter
  • Ultimate Starter Kit > Narrative > Show
  • Ultimate Starter Kit > Narrative > Destroy

C++ Usage

Before you can use the plugin, you first need to enable the plugin in your Build.cs file:

PublicDependencyModuleNames.Add("USK");

The WorldTextLetterWidget can now be used in any of your C++ files:

#include "USK/Narrative/WorldTextLetterWidget.h"

void ATestActor::Test()
{
    // WorldTextLetterWidget is a pointer to the UWorldTextLetterWidget
    WorldTextLetterWidget->InitializeLetter(Word, Letter);
    WorldTextLetterWidget->UpdateNextLetter(Letter);
    WorldTextLetterWidget->Show(Index);
    WorldTextLetterWidget->Destroy();
}