x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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

Product Version: UE 4.21
Tags:
more ▼

asked Jan 11 '19 at 02:25 AM in Blueprint Scripting

avatar image

Blackhole303
1 1 1

avatar image ThompsonN13 Jan 11 '19 at 03:24 AM

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.

avatar image ThompsonN13 Jan 11 '19 at 03:30 AM

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.

https://www.tomlooman.com/creating-actor-widgets-umg/

avatar image Blackhole303 Jan 11 '19 at 09:04 PM

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

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

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

more ▼

answered Jan 11 '19 at 06:50 AM

avatar image

MisterHB212
21 1 1

(comments are locked)
10|2000 characters needed characters left

https://youtu.be/Zcg7aun1s_M

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

more ▼

answered Jan 11 '19 at 07:40 PM

avatar image

CoalFireGaming
236 2 5 5

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question