Search Unity

Trouble making the Main Menu "Start" button work

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

  1. Dulas

    Dulas

    Joined:
    May 31, 2015
    Posts:
    15
    The Main Menu is a scene, named "Main Menu". I want to load the next scene, called "Game". The Main Menu has 2 components: an image and the "Start" text. To the text, I attached this script:
    Code (CSharp):
    1. public class Start_Script : MonoBehaviour {
    2.     void OnMouseEnter()
    3.     {
    4.         Application.LoadLevel ("Game");
    5.     }
    6. }
    But when I click it, it doesn't work. How to solve it?
     
  2. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    Does you GameObject have a collider? OnMouseDown is only called on objects with a collider.

    These days you are probably better off using the event system interfaces anyway.