Skip to content

World Text Widget

Introduction

The widget used to display text in the world

Dependencies

The WorldTextWidget relies on other components of this plugin to work:

  • Audio: Used to play sound effects either 2D or at a specified location

Required Widgets

There is already a WorldTextWidget_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
Container The container for all the word widgets UWrapBox*

API Reference

Properties

Property Description Type Default Value
DestroyTextDelay The delay before destroying the text widget after typing has finished float 2.0f
DestroyActorDelay The delay before destroying the actor after the text widget has been destroyed float 1.0f

Events

Name Description Params
OnDestroyed Event used to notify other classes when the text is destroyed

Functions

Name Description Params Return
InitializeWidget Initialize the widget WordClass (TSubclassOf)
The world word widget class

LetterClass (TSubclassOf)
The world letter widget class
Show Show the text in the widget Text (FText&)
The text to display

Sound (USoundBase*)
The sound to play when displaying the text

PlaySoundAtActor (AActor*)
The actor to play the sound at
Destroy Destroy the text widget
GetWordWidgetClass Get the world word widget class TSubclassOf<UWorldTextWordWidget>
The world word widget class
GetLetterWidgetClass Get the world letter widget class TSubclassOf<UWorldTextLetterWidget>
The world letter widget class

Blueprint Usage

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

  • Ultimate Starter Kit > Narrative > Initialize Widget
  • Ultimate Starter Kit > Narrative > Show
  • Ultimate Starter Kit > Narrative > Destroy
  • Ultimate Starter Kit > Narrative > Get Word Widget Class
  • Ultimate Starter Kit > Narrative > Get Letter Widget Class

C++ Usage

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

PublicDependencyModuleNames.Add("USK");

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

#include "USK/Narrative/WorldTextWidget.h"

void ATestActor::Test()
{
    // WorldTextWidget is a pointer to the UWorldTextWidget
    WorldTextWidget->InitializeWidget(WordClass, LetterClass);
    WorldTextWidget->Show(Text, Sound, PlaySoundAtActor);
    WorldTextWidget->Destroy();
    TSubclassOf<UWorldTextWordWidget> WordWidgetClass = WorldTextWidget->GetWordWidgetClass();
    TSubclassOf<UWorldTextLetterWidget> LetterWidgetClass = WorldTextWidget->GetLetterWidgetClass();
}