Switching menus recommondations

What is the recommended way to switch/present a new menu? Do you go like this:

mainMenu.SetActive(false);
optionsMenu.SetActive(true);

What if you want to have the main menu slide off and the options menu to fade in? Also, if the main menu is sliding off then can’t the buttons still be pressed while the menu is sliding (which would result in bugs)? Should you use Mecanim for this type of stuff?

You can use Mecanim or a custom tweening solution for this. I would make it so there is a canvas group on the panel, then disable raycasting against the group (it’s the ‘blocks raycasts’ field), slide the field off screen (or fade it), then set active to false. The opposite if you want to show it.

1 Like