Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We’re making changes to the Unity Runtime Fee pricing policy that we announced on September 12th. Access our latest thread for more information!
    Dismiss Notice
  3. Dismiss Notice

Switching menus recommondations

Discussion in 'UGUI & TextMesh Pro' started by User340, Aug 23, 2014.

  1. User340


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

    Code (csharp):
    1. mainMenu.SetActive(false);
    2. 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?
    Last edited: Aug 23, 2014
  2. Tim-C


    Unity Technologies

    Feb 6, 2010
    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.
    User340 likes this.