How to make a simple menu button with C Sharp

Hi, I’m very new to unity and coding and I have to make a simple game for my uni course.

All I want is a to make a button on the main menu that when clicked will load the level.

I’ve made the menu screen with a “Start” text (I think I made it a 3D text, not GUI) and this is the script I’ve got so far that I’ve managed to jumble together from looking at other online sources but it doesn’t work:

using UnityEngine;
using System.Collections;

public class ButtonScript: MonoBehaviour 
{
public bool isQuit = false;

void OnMouseDown ()
{
if(isQuit)
{
Application.Quit ();
}
else
{
Application.LoadLevel ("flyinglevel");

}
}
}

Any help would be greatly appreciated

Thanks

Chris

Hello Chris and welcome to the community, you can simply use this code:

void OnGUI(){
//Here if the player hit the button Start will trigger an action
if(GUI.Button(new Rect(Screen.width/2, Screen.height/2, 100, 25), "Start Game!")){
//Here we call the method who will call the level named "LevelName"
Application.LoadLevel("LevelName");
}
}

Also See: GUI.Button and Application

Give it a shot!
Good Luck!