Cast Text from Level Blueprint to HUD

This question seems pretty simple, but I can’t figure it out.

So I am making a simple script where i can use the gamepad to scroll up and down a list of locations on the map, and pulling the trigger will teleport there.

I want to cast the TEL_TEXT (name of teleport destination, as selected by the array Get) to the HUD blueprint, but I have no idea how to get the Text to the UMG. The very last step i need!

(I tried building this the teleport part in the FirstPersonCharacter bp, and the text in the HUD blp, which works, but then I can’t directly reference the locations (characters) and I have to use a “Get All characters” which does not do it in the order I want. Also, if i were to have multiple levels, then hosting it not on the level would break it?)

Anyways, thanks for your help ^_______^

To get a reference to a specific UMG widget you have two options.

  1. When you create that widget store a reference to it. Example would be in your Player Controller use Create Widget to create your CoolHUDWidget. Then store a reference in a variable of the Player Controller called “coolHUDWidgetRef”. Then in the future to get access to it just do Get Player Controller->Cast to MyPlayerController-> get coolHUDWidgetRef.
  2. Alternatively you can do a GetAllWidgetsOfClass then for each (or just index 0 if you know there i one) you can cast to your CoolHUDWidget.

Once you have the reference just set the proper variable that is driving your text field.