Do Blueprint Interfaces still work?

Hey guys i got a problem with my blueprint interfaces with don’t seem to work.

To my project. I have a blueprint, a widget blueprint and a blueprint interface.

In the blueprint i set a varabiable money.

Then i added the interface to the blueprint. I hooked the variable “money” up to the output of the interface.

Then i add the interface to my widget blueprint and call the message “money” while context sensitive is turned of.I hook it up to the Return Node of the GetText-function and it doesnt update.

But If i open the interface in the widget blueprint and put a value in the Return node there, it shows the value i put in the interface before.

Also noteworty is that the blueprint is an actor in the level not the game character. so i dont know how to reference this.

Hi there,

you are actually asking your Widget for Money :slight_smile: What you need to do is using the Actor instead of “Self” when calling the interface.

Since you use an interface I assume you have multiple actors in the level. Do you get the actor when colliding with something or how do you know which actor you want to have the Money from? So I can explain you how to reference it.

happy debugging :slight_smile: Marooney

there is only my character and a boss that dies when the health <= 0. then i set its collision and the visibility to both false, reposition it random in a box and undo both collision and visibility.Also i have a hit event that reduces the health variable.

You could create a variable named Player with type Actor in the widget and in your character (in the beginPlay event maybe?) you could access the widget’s variable Player and set it to a reference of the character.

Ok, so if there is only one enemy i think this solution might help you:

You need to tell your Widget where to get the Money-Value from.
This will be your Eater_BP I guess. The easiest way to access your Eater_BP will be to store it in the GameMode. Since you have an interface you can use this as variable type.

So everything that uses your interface can be assigned. This is how the Eater_BP assigns it self to the GameMode when spawned:

And now you have access to your Eater_BP and the Money within the Widget:
Since you have access to the GameMode from everywhere, you can access the Boss-Variable too:

I hope that helps :slight_smile: Marooney

thanks Marooney for the quick answer but the cast to gamemode in the widget always failes for me, though i changed the gamemode

Well… try this and see what comes out. If it is your GameMode then there is no reason why the cast fails. You probably just used the wrong Cast node. And if it is not your own GameMode then you need to set it within the ProjectSettings or within the Level.

100330-checkgamemode.jpg

thanks :slight_smile: now it works. but why doesnt the blueprint interface works like i set it up? it did months ago also still works like a charm in another project.

Because you did the Interface-Call on the Widget (Self-Node) instead of the Actor. And your Widget does not have or does not need to react to the Money-Function-Call at all. :slight_smile:

I’m happy to help :slight_smile:

If you are good to go, please make sure to click the accept answer button to mark the question as [RESOLVED] for everyone. thx :slight_smile:

one last question is there any trick to know what to reference? because sometimes im stuck there