Getting a widget to display variable from actor

Hi,

I’m trying to set up name tags for enemy characters using blueprint. Each enemy actor has an associated variable called name, which is different for each enemy. What is the simplest way to display that name over each enemy? (I’m assuming this uses widgets, but I can’t figure out how)

Thanks

to pass the needed info you will either need to have a reference to the actor in the widget or have a reference to the widget in the actor. now you could easily add a widget component in the actor and set the widget to the nameplate widget you have made, the problem is i only remember how to set the variable from the event graph by getting the widget component, then get user widget object, then cast to the class you are using, then you can set a variable in the widget from there.

maybe someone else knows a better method, im sure theres a better method out there.

hmmm well i suppose its not the worst method after all. was doing a search for more info on the topic and came to a article written by Tom Looman which uses the same method.

Set a variable and place a text over his head when you edit the BP. Then just set the text to display the variable.

Heres a quick example I setup for you. Try this.

that worked! setting up an “owning actor” variable for the name tag widget is what I was missing