From initial creation, the widget is working as it is, but after looking away, the widget dissapears.
in my BP_Ball , I created the widget and added to viewport from BeginPlay and each tick it will update the widget screen position to follow the Ball location
I’ve also tried using a widget component inside BP_Ball as it can follow the mesh without dissapearing. But the problem with widget component is that I can’t change the Text name.
you can add a Widget as Actor Component directly to your Ball BP. In that component, you select the class of your Widget and set the View mode from world to screen.
that way, the widget stays above the ball, but keeps being visible as long as it is in the far range if the camera (as all Objects do).
the thing with screenspace View is, that the widget is oriented to the camera all the time, cause its in 2D Space, and updates its own position according to the Actor’s position by itself.
To set the text or your Widget, you take the component as Get in your Ball Graph, from that component take a “GetWidget” Node. From there a “Cast to (your widget class name)” and from cast, you can call events and functions of your widget.
Off-screen widgets do not tick. Once away, the widget has no chance to tick update position itself back to screen. If you moved the update to the actor who then updates the widget position, it would work:
Update the widget here, you’re Ticking this anyway.
A widget component would work as well, of course; do note those add quite a bit of overhead. Probably negligible with only 20 of them, though.