Cast To Widget In Blueprint Not Working?

Hi guys,

i try to simply pass the score to my hud, but it is not working as all attempts create errors.
i use a blueprint with a triggerbox that adds to the scoreboard once the playball overlaps.

i tried to use get hud, get player character as the object, tried an instance of the widget itself… nothing is working?


This issue has been mentioned for several times. The thing is this is not the proper way in dealing with a widget, in fact, casting to a widget is being used to get values not to set them (get values from widget functions). You’d better do the same things from the widget side and cast to the blueprints from there if you planned to set a value. Actually you CAN set a value of a widget from another BP, but it will affect all the children, that’s why I don’t recommend it. So go to the widget BP > bound function and start from there. Note that there is no any hit, overlap … events inside the widget BP, so if you’re gonna call a widget to change something on a specific event, you can create a variable (like a bool) and try to read the variable from the widget BP by a simple casting node. Hope this help.


thank you sir!

well now i got another problem. i cannot create a reference to my goal blueprint to receive that variable we were talking about.

If it’s your pawn, use ‘get player pawn’ as cast object inside the widget graph. If its game state, player controller … get them in the same way. If not, you must put the variable in one of the get-able blueprints. Unfortunately you can’t set a BP as a reference variable inside a widget (as far as I know). Because it won’t allow you to choose an initial value for that.

thank you again.
sadness :stuck_out_tongue: