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 have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Little issue with switching in between Main Menu and the other scene

Discussion in 'UGUI & TextMesh Pro' started by Dulas, Jun 25, 2015.

  1. Dulas

    Dulas

    Joined:
    May 31, 2015
    Posts:
    15
    The main menu I developed as a scene, consisting in an image and the "Start" text in the middle. To the "Start" text, I attached a script:
    Code (CSharp):
    1. public class Start_Script : MonoBehaviour {
    2.  
    3.     void OnMouseEnter()
    4.     {
    5.         Application.LoadLevel ("Game");
    6.     }
    7.  
    8.     void Update()
    9.     {
    10.         if(Input.GetKey(KeyCode.Escape))
    11.         {
    12.             Application.Quit();
    13.         }
    14.     }
    15. }
    And in the main script, you have to remember this:
    Code (CSharp):
    1. void Update()
    2.     {
    3.         if (Input.GetKey (KeyCode.Escape))
    4.         {
    5.             Application.LoadLevel ("Main Menu");
    6.         }
    7.     }
    Yes they are correctly named "Game" and "Main Menu". But, after building the game, when clicking the "Start" text, nothing happens. Any idea on how to solve this? Much appreciated, guys.
     
    Last edited: Jun 27, 2015
  2. LeftyRighty

    LeftyRighty

    Joined:
    Nov 2, 2012
    Posts:
    5,148
    did you include all the scenes in the build?
     
  3. Dulas

    Dulas

    Joined:
    May 31, 2015
    Posts:
    15
    Yes, I did. I only have 2 scenes. The "Main Menu" and "Game" ("Game" is just one scene).
     
    Last edited: Jun 26, 2015