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.
you are actually asking your Widget for Money 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.
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.
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:
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.
thanks 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.
I’m happy to help
If you are good to go, please make sure to click the accept answer button to mark the question as [RESOLVED] for everyone. thx