Ricardo
8
Q:

unity menu controller code

         int VerticalInput = (int)Input.GetAxis("Vertical");     // Read in the Vertical input from the controller
 
         // Activate the menu from the title screen, and revert to the title screen
         if (!MenuActive && Input.anyKeyDown)                    
             TurnOnMenu();
 
         else if (MenuActive && Input.GetButtonDown("B"))
             TurnOnTitle();
 
         // main menu controls
         if (MenuActive)
         {
             if (VerticalInput != 0)     // If the player is giving a vertical input
             {
                 StartCoroutine(MenuChange(VerticalInput));      // change the menu
             }
             MainMenu[Selected].GetComponent<Button>().Select();     // mark the current button selected as selected
         }
     }
 IEnumerator MenuChange(int input)
     {
         if (input < 0 && Selected < MainMenu.Length - 1)
             Selected++;
         else if (input > 0 && Selected > 0)
             Selected--;
 
         yield return new WaitForSeconds(1f);
         StopCoroutine(MenuChange(0));
     }
0

New to Communities?

Join the community