How do I cast from one UI widget to another UI?

Title is self explanatory… I looked it up already and I got the following:

But it doesn’t work

P.S if I put this on an event tick in the event graph, same result… The text still won’t display my value from the other UI widget

Not sure if I understand your setup. You do get all but don’t specify an index which leads me to believe there is only one woodclicker widget. Get all nodes are very heavy and quite often unnecessary. I think you would have more luck with a variable text and use set text

Are you trying to update a text in your woodclicker widget?

As for referencing, you can use the node “get user widget object” as a valid reference instead.

Maybe this will help. I show you how to reference one widget from another widget. It is a viewport widget and a 3D widget component on an actor.

If that doesn’t help check out video #25 about creating references. Towards the end I specifically discuss a widget reference but the other means of creating references may also be helpful.

No I’m trying to just get the text… from that widget

This is all UI there is no… 3Dness aspects such as actors

If I need an object… I need to understand how to integrate an object…

What do you mean “integrate an object”?? A widget must be created by an actor or a global blueprint type like the level or game instance etc. So wherever you create widget A save the output as an object reference variable. Same thing with widget B. Then you somehow will need to reference the actor that created one of the widgets from within the other widget, or get a reference to the global blueprint (think game instance/ level bp etc) from the second widget to grab the variable of the other widget. Either way you’re going to need an actor at some point. It would be an extremely odd setup to not use an actor anywhere.

Then make sure the text in the widget is set to variable (top right in the widget designer). Then give it a name you remember. And after you set your reference just get the text name.

Here’s some examples:

Is that what you’re looking for?

Well it might not be exactly what you need but what this is, is simply a general interaction widget for NPCs, which I add as a widget component to the actor. I then cast to it in order to change the variable text.

I think in your case you are looking for more of a player HUD object. Like these tooltip widgets for example:

That would be better, but how do i get that target: interaction widget…? I get lost when it comes to cross widget variable interaction :stuck_out_tongue:

Sorry, I’m lost :stuck_out_tongue:

It is! This whole thing is to create a widget when hovered over a button, and then it displays info about what you are hovering, how much it costs, and the quantity you have, all of which variables are specified in the UI widget; “WoodClicker” and Each hover widget is its own special widget. So I don’t understand adding actors so I can do this… and all the youtube tutorials and unreal engine documents confuse me… Do you know a way I can do this… basically the object is the only thing that has made me not be able to get this to work for the past week :stuck_out_tongue:

I still don’t know how to get an object from that though…

Well it depends a lot on how you have built your system, but as for a tooltip I recommend watching this video and see if you get any ideas from it:

Essentially what it does is detect on mouse over, then casts to a tooltip widget which is reusable, so no need to create a new one, and simply updates the information. Here’s a highlevel view of the type of script in the tooltip widget:

It’s just going through the same process for multiple values, not too bad. But the casting happens by the inventory system, through the slot widget in the inventory which detects the mouse over, which then casts to the tooltip widget the item class and the tooltip widget then extracts the info from that class. If that makes sense.

Just watch the video is my suggestion.

Well for the enemy widgets for example it’s a simple matter of just dragging it into the blueprint and using get user widget object.

The tooltip widget is created for each inventory slot that contains anything and updates every time I add something to inventory. Then simply set to visible when I mouse over it. Now of course you could create the tooltip widgets as you mouse over them instead… But I don’t see much point. Again, watch the vid. He explains it very well.

Wait where do I put my casting? in the actor bp?

This I ended up figuring out; Thanks for your help!