How to get reference to a widget from another widget?

The title might be confusing but let me try to explain from this diagram

I am working on party menu (black mark) where inside has multiple widget blueprint on it. One of it is the equipment widget (marked with red). When I clicked one of the box under that equipment widget, it will show inventory widget (marked with blue) that listed all the available equipment I can use.

Problem is I dont know how to send back the related item data that I have chosen to the equipment widget. The only thing I can think of is to store the item data on game instance but not sure if this is a good idea or not.

I DONT USE A HUD

I DONT LIKE IT FOR ALL THINGS

I SPAWN UI IN PLAYER

I GET CHARACTER REFERENCE IN UI

I GET VARIABLE REFERENCES SPAWNED FROM PLAYER CHARACTER FOR EACH UI WIDGET

I CAN REFERENCE THEM THAT WAY

how do you pass the character reference in UI? Is it possible to pass variable when adding to viewport?

THATS A LITTLE BASIC

CHECK MY PROFILE FOR LINKS

THOSE WILL GET YOU UP TO SPEED IN 4 - 10 HOURS AND YOU’LL BE A LITTLE MORE BONAFIDE

GO TO YT THEY’RE FREE

You can pass variables to the widget when creating them.

Select the variable in the widget, in the Details panel, enable Instance Editable
image

and Expose on Spawn
image

Then when you create the widget, the Create Widget node will have pins for the variable that you can use to pass in the reference.

image

When you create sub-widgets in your main widget you have to make sure to build main widget variable in those sub widgets and then self ref main widget to it.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.