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

Starting the game from Main Menu not working with OnMouseEnter

Discussion in 'Scripting' started by Dulas, Jun 27, 2015.

  1. Dulas

    Dulas

    Joined:
    May 31, 2015
    Posts:
    15
    I have 2 scenes. One is "Main Menu", consisting in a black image and a text ( they are independent one from another, in other words, they are 2 components ), and the other one is "Game". The text in the Main Menu is "START". To this text, I attached this script:
    Code (CSharp):
    1. public class Start_Script : MonoBehaviour {
    2.     void OnMouseEnter()
    3.     {
    4.         Application.LoadLevel ("Game");
    5.     }
    6.     void Update()
    7.     {
    8.         if(Input.GetKey(KeyCode.Escape))
    9.         {
    10.             Application.Quit();
    11.         }
    12.     }
    13. }
    But when I click the text, nothing happens. How can I fix this? Thanks, guys.
     
  2. lineupthesky

    lineupthesky

    Joined:
    Jan 31, 2015
    Posts:
    92
  3. Dulas

    Dulas

    Joined:
    May 31, 2015
    Posts:
    15
    I'm not managing to make it work, man...Help me out here