My casting is failing in WidgetBlueprint

My casting is failing, I have a health variable in NormalBot Bp , and i updating this variable on the widget.

Where to add event tick?

Its printing health “0” , and casting is failing. I think casting is issue

Its on non pure only

I think you need a tick event to constantly update it, because it seems as it does it once

okay i got it heres what i did that would work for you

the code is the same as what you wrote in the function of the widget (dont change it)

And the blueprint on here is on the event graph tab, as seen here it will constantly update, get the percent, and print it (or change where the value is going besides print), ALSO, convert the function from your widget into non pure (you can see on the side detail, then hook it up and it should work like mine.

the node is from changing it to non pure, to change it to non pure you go into the function blueprint, and once there you will see on the left, something called “details”, then uncheck “pure”. And try again

Yes its good and working as mine, Though the reason the casting is failing randomly or sometimes is because when your casting to a actor / pawn / character, you have to have something that goes off that or “overlaps” it (like touching a block, you’re able to cast because it touched that block), so that means that something in the blueprint within the character messes up the connection to that widget, and a widget must be active if you want to be ABLE to cast to the player, so that means its off when it does that. Try going through the blueprint code you have to see what could be the reason.

Can you check this file out, this is just the Ai bot