Ow, so if i have hundreds of items,
objects, enemies, would i have to
create these nodes manually for each
thing?
No, it’s enough to make it once in the base class. Children will inherit it automagically.
Parent Actor of a widget
Parent of the widget is the viewport, not the component. The component simply adds it to the viewport.
I mean, it should just check what its
parent is. Wishful thinking? I can’t
imagine it being that complex but i’m
most likely wrong.
It’s not. Describe what you want to achieve. Perhaps I can chip in or at least point you in the right direction. What I posted already gives your actor full & direct access to the widget. What more do you need?
couldn’t recreate your BP by the way
at least not in a way that I can
set the text…*
Why not? On actor Tick, get Text Block from from My Widget → Set Text. Done. You do not even need a Custom Event like in my example. Simply flag the text block as variable at the top of its panel.
As I initially suggested, what you’re doing in your example is not the best approach, it will give you a headache sooner or later. Consider following what I suggested - have the actor do the math and push it to the widget.
On the other hand, If you absolutely must give the widget access to the actor and use function binding, create an actor reference in the widget, expose it on spawn and set the reference this way. From now on the widget can pull data from the actor.
But even with this method I wouldn’t trust the widget to calculate anything. It’s just bad karma. It might not be a bad idea to let the widget format their output text. In which case, I’d have a dedicated variable in the widget and let the bind format that.
You definitely do not need C++ for this.