I’ve been trying to figure out one issue that I have with casting from one UI to another. After looking at some other posts, turns out there’s not just one answer for this, so I’ll give some context before describing the main issue.
I have a Main Menu that is split into three sections named Section 1, 2, and 3. Section 1 is the left panel (similar to the one that you can expand by hovering over it from Fortnite), where you can quit the game, access the options and quick functions etc. Then there’s Section 2, in which the main game logo sits, together with a Quick Info box which displays summarized information about anything that the mouse is hovered over and has different default displays for each tab on Section 3. And lastly, Section 3 is the one in which you can switch tabs to display different pages (like in Counter-Strike 2).
(Not a finished menu just yet.)
The issue is that all of these sections don’t sit within the MainMenu altogether, they are displayed there as different UIs in different spaces, because to keep things more organised (which was a really bad idea now that I look back on that decision), I made all of these sections a separate UI blueprint in the Content Browser.
The issue now, is that whenever I want any of these buttons to do anything within the big space under the Section 3 tabs, I have to cast to the MainMenu, because the widget switcher that controls these tabs sits in there.
And I hate casting. Because I never know what to put for that ■■■■■■■ Object value.
Users from other questions like these say that I need the reference to the Main Menu as the object, but I have no idea how to get it, because I’ve tried all object references to do with UIs in the variable types, tried all sorts of Get User (something), I have no idea where to get it from.
I really regret making these sections separate widgets now.
Any help would be appreciated.
Thank you!