How Do I Hide the Previous Menu Interface when I click into a new one?

I’m building a menu with submenus within it and I need a function to hide the previous menu every time I click into a new one.

As an example, I just figured out how to create a “back” button in a sub menu, but when I click back to the main menu, that sub menu remains. I know there is a get visibility node that I can use but I cannot figure out how to implement it.

1 Like

I recommend creating a new widget and adding a switcher to it. From there, you can use an integer to switch between different tabs, such as “Options”, “Controls”, “Settings”, etc. Hope this helps solve your problem :blush:

image

1 Like

I forgot to mention that you should use the “Set Active Widget” node, with the target being the switch. The switch should an enabled variable.


EDIT: I seem to have fixed the problem, which was that the “Back” button was, in fact, not functional so nothing happened when I clicked on it. I added the widget switcher index code to the “Back” button instead of the code that would add the “Main Menu” to the viewport when clicked, so now it works properly. Leaving my error here below just in case it helps someone, I guess.

Original Post:
When I click into a sub menu, I am unable to hit the back button although the button itself is functioning, so I am stuck in the submenu after transitioning to it. This is my code but I am not sure what I am missing. I get the error:

“Blueprint Runtime Error: “Accessed None trying to read (real) property MainMenuSwitcher in Main_Menu_C”. Node: Set Active Widget Index Graph: EventGraph Function: Execute Ubergraph Main Menu Blueprint: Main_Menu”