Access widget variable from another widget

Hi there,

I have a menu that has many menu buttons (let’s call that Widget0). Once a menu button is activated it displays a widget (Widget 1 or 2). I need to check if one variable in Widget 1 is a certain value from Widget 2. How do I go about doing that when I tried accessing it through GetAllWidgetsOfClass + Get + variable but nothing happened?

I realize there has to be some casting done but after digging for hours I am still not sure I fully understand how it works. Could you please help? I am using UE5.1 blueprints

From your player controller, create the widget 0 and store it to a variable.

store all variables from the widget 0, this way inside widget 1 or 2 bp event, you can do a casting : get player controller > your player controller bp > get widget 0 variable.

or before creating widget 1 or 2, just directly get/set the variables from widget 0.

What are you trying to accomplish exactly ?, kinda hard to propose a specific way of doing it.

There also passing variables with events that can be something you can look into.

Widgets will only hold their data when constructed, so if the widget with the data is not currently active it will fail, have you tried toggling visibility or remove from viewport instead of destruct when opening the other widget, could also utilize a widget switcher to keep both in memory