Download

Widget text loading from variable

Hello, I know this been ask, but I have tried a few way and it doesn’t work for me. I am in U4.26.2
I have many room of a building I need the user when it click to get some info and one image.
I have created a pawn BP for each room ( a transparent box) then inside that box I have placed a variable.
When I create the widget I chosen the text create a biding as the image below.
Nothing happens. The Widget UI shows but the text is empty.
When I check the biding nodes I can see in there that it is loading the variable info, but the text is not showing on the widget.
I have researched online, but I can’t find why my code is not working. Your help is appreciated.

Why would you use a Pawn as a base for a room class? Pawns are designed to provide an easy way to implement input from players or from AI. Unless the game is built around you becoming the rooms of a building, I don’t think it makes sense.

Now, the problem is that “Get Player Pawn” is returning the Pawn that is your player. You’ll need to find a different way to obtain a reference to a room (probably involving overlap events).

Also, using the “bind” method with UMG can impact performance because runs the function every frame. If the text is changing every frame, then it’s fine. Otherwise, change the text in the Event Graph.

First, thanks for the answer.
I guess I didn’t explain clearly what I was doin, also I am learning as I go with Blueprints, so I am pretty sure I am not doing thing the optimum way.
I didn’t do the whole room a Pawn. I have a 1 story building that is in section view, so you can see the interior (no roof) and I create a transparent box tat cover the top of each room. The idea is the user will move the mice/pointer ofer each room and then the “room” will hight light or click on it and get information. In reality they are not clicking the room but the transparent box in top of it.
I have review many Youtube and post of similar situation, but most of them seems more complex than what I am trying to do. I have realized by try an error that on my code I was calling the player and not the object(transparent box)
I have it working now with a ‘call all actors of class’ node but the problem now if since this box is repeated many times in my scene now all the text reads the same :stuck_out_tongue: I thought when you create an instance each one of them could gives you different data, if that data is exposed.
In resume, imagine I created a blueprint(box), that when mouse over, its clow, then if you click then it show text info. Then I duplicated that box 10 times, each one of them should glow a different color and submit different text to the same bae text widget…
Thank for your time.