0
\$\begingroup\$

What I'm trying to do: (a 'long story version' is linked in comment below)

(and another user example is hyperlinked in comment below - i couldn't post over 8 images and/or links in this first comment*) (there are other similar user questions elsewhere I know)

Short story: I'm trying to make a widget that is triggered by an actor blueprint, and I want the widget to display different text that reflects the public-variable-text edits I make in the editor.

My latest progress includes actors that are titled somewhat according to the hyperlinked user case above so, I have a "door_trigger" and a "doorWidget". I have altered the pin connections so much that I am just going to copy and paste all my screen shots below.

I got to change text asset DoorName by making a public variable called "name," as you'll see. I can make the trigger show this text on screen and have it disappear when the user leaves the trigger actor, BUT EVERY INSTANCE ALSO SHOWS THIS TEXT VALUE, EVEN THOUGH I CHANGE IT

In the screenshots (some in comment following too) you'll see the text "3" appear on screen, and it does this for all three of the dummy boxes I made; notice how the second box is supposed to show "dd" (I was just typing random filler content).

ALL HELP SO APPRECIATED!!!!! Thank you!!!

alt text alt text alt text alt text alt text

enter image description here enter image description here enter image description here enter image description here enter image description here enter image description here

enter image description here enter image description here

\$\endgroup\$
2

2 Answers 2

1
\$\begingroup\$

A more efficient and clear way to do this is to use DataTables, instead of setting the name of each door, you can have an ID for each door and when the Player enters the collision, you can get the information of that door from the DataTable using that door's unique ID and display it on screen, this way you can be sure that every door has its unique ID which won't mess up the information you would like to display on screen.

Anyway, I believe that the reason why your code isn't working is because of the code after the "Get All Actors of class" node that you're using on the "Event Construct" node in the DoorWidget Blueprint, can you please try to use the "Print String" node in order to debug your code, that way you can efficiently debug and trace the values and how they're changing while your code is executing. Best of Luck!

\$\endgroup\$
0
\$\begingroup\$

The reason that this isn't working here is that you're looping through all the triggers but you're only setting the Name reference once the loop is completed so it's only pulling the information from the last found trigger. This will also happen if you move the pin to the Loop Body, unless you find a way to use a boolean to match up the correct trigger.

There are various ways to do what you're trying to do to get the trigger without booleans or the Loop Body.

The easiest is probably to use your existing door_trig BP variable in the widget blueprint, click the options to make it public and Expose on Spawn. In the Door Trigger blueprint, refresh or recreate the Create Widget node and you'll see your a new pin to plug in to. Create a reference to Self and plug this in to the pin.

This will pass in the reference of the trigger to the widget so you don't need to get all the actors or loop through them. The reference will be there immediately.

\$\endgroup\$
1
  • \$\begingroup\$ Thanks! Somehow I wasn't notified of this answer and have since re-engineered it. I'll look at your answer more in-depth when I have time :) \$\endgroup\$
    – Stuart
    Commented Jun 25, 2021 at 21:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .