Update widget text variable through interaction?

Hey all,

I have a widget blueprint that I am using as a 3D widget in another blueprint, as the screen of a monitor.

There are two individual button blueprint actors in my scene, that I can interact with.

What I’m trying to figure out is how I can update text in my widget, whenever I interact with one of these buttons, as well as having different text updates based on which button is pressed.

I’m currently stuck in my character BP, LineTracing and calling a function in my blueprint interface, if my trace hits one of the buttons. But then I’m not sure where to go from there.

Do I need to set my Widget as my target when calling my BPI function?
But then do I somehow need to call my Widget Blueprint, within my character BP?

This might be a bit unclear, so in it’s simplest form, I want to have text on a 3D Widget in my level, and have text within it to update based on which of 2 buttons I press. Almost like a back and forth dialogue, with the in game screen asking question, and me replying with only 2 buttons as answers.

Cheers

Hi @flossyahova,

This is more or less how I’d go about this:

  1. Have a text element on your widget (I assume you already have this)
  2. Have a text or string variable on your Character BP, or somewhere else centrally available that the widget can read from
  3. Depending on if you hit button 1 or button 2, update the text variable on your character to reflect what you would want to show on the widget
  4. Inside the widget, on your text element, creating a new binding for the actual text content
  5. Implement the binding function to get the variable you care about from your Character BP, or wherever else you choose to store it, and return it
  6. Now the text in your widget should always reflect what you set in your character based on which button is pressed

I hope this is what you were going for, and that it proves helpful.

Thanks,
Hayden

Hello Hayden,

Thanks for the reply. I would really appreciate it if you could develop part 5. a bit more, let’s say my dialogue lines are in a data table, how would I call these dialogue lines in the text variable binding from my Widget Blueprint?

Cheers