How to use Blueprint Interface with Widget Blueprint

I have a Widget Blueprint for my in-game HUD and i want it to play an animation for when the next round Starts, i already use Blueprint interfaces for making the zombies go faster every round, but i tried making a reference to the UI and it doesn’t seem to work (unless i’m doing something wrong, which i’m most certain is the case)

(Excuses in advanced if my english is not the best)

It works the same as with actors. Any chance you could show how you obtain the reference to the widget?

Sorry for the late response, i’ve been a bit busy irl.


image
I use an Object Reference of the UI Widget and use the interface, i have set it up so it prints to the screen when the event is triggered, but the animation doesn’t trigger and the string doesn’t print.

this is the BP on the Widget if it helps on finding what i did wrong.

Agan sorry for the late response.

If you need anything else feel free to ask me.

Same as before: How do you obtain the reference to the widget? How did you set its value?

like this

This is not a reference (yet). This is a just a variable of a specific type. Imagine you created a string variable but forgot to type in the text. That’s what you have now, an empty variable, so to speak.

A variable that could point to a widget… but where is the widget? When you create a widget (or actor) you assign the variable a value:

image

I think that is what i might’ve missed, i’ll try to see if i can correct it later when i finish some stuff i have to do, if you could and if it’s not that bothersome could you tell how to point that variable, or make a reference that points to that widget from another blueprint that didn’t construct that widget?, since i create the widget from the actor that triggers the event.

And thanks for the help btw, i appreciate it very mutch

We’d need to know 2 things:

  • where (in which BP) is the widget created, and how, and when
  • which BP is trying to access it, and when (you say “when rounds starts” - what triggers it, though?)

So that’s like 5 things.

I have a Widget Blueprint for my in-game HUD and i want it to play an animation for when the next round Starts

So yeah, what is in-game HUD, how did it make it into the game? And which BP triggers the round
start?


If you used a framework class like game mode or player controller or a possessed pawn to create the widget, you won’t even need an interface.

Sorry for the late response.

image
UI Ingame is the HUD which is created by the Player Character on BeginPlay


And the Blueprint that tries to send the message to the HUD to play the animation is an Actor that controls everyting related to sounds and Spawns
image


which is triggered when the round ends.

apologies for the late response.

Reference the widget, promote Return Value to a variable, then any BP can access it.

No need for an interface, a simple cast is enough. But the interface is fine, too.

1 Like

Thanks for the help, it works now

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.