Skip to content

Interact Widget

Introduction

The widget displayed when the player can interact with an object

Dependencies

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

  • Logger: Used to log useful information to help you debug any issues you might experience

Required Widgets

You need to add the following before you can compile the InteractWidget widget:

Name Description Type
BeforeTextBlock The text block used to display the text before the input indicator UTextBlock*
AfterTextBlock The text block used to display the text after the input indicator UTextBlock*

Optional Animations

You can add the following widgets to enable extra functionality:

Name Description
ShowAnimation The animation played when the widget is shown

API Reference

Properties

Property Description Type Default Value
ShowAnimation The animation played when the widget is shown UWidgetAnimation* nullptr

Functions

Name Description Params Return
Show Show the interact widget BeforeText (FText)
The text displayed before the input indicator

AfterText (FText)
The text displayed after the input indicator
Hide Hide the interact widget

Blueprint Usage

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

  • Ultimate Starter Kit > UI > Show
  • Ultimate Starter Kit > UI > Hide

C++ Usage

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

PublicDependencyModuleNames.Add("USK");

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

#include "USK/Widgets/InteractWidget.h"

void ATestActor::Test()
{
    // InteractWidget is a pointer to the UInteractWidget
    InteractWidget->Show(BeforeText, AfterText);
    InteractWidget->Hide();
}