Easy simple menu for a beginner

OK, Im new to unity and so I’ve made my game but now I’ve started on a menu. I have looked around on youtube for a simple menu and so far i have this: 2 3d texts, 1st says Start & 2nd say Quit. Nothing more then just 2 texts on a background now all i need is a script of either java/c# so when i press play, it goes to my game scene and when i press exit, it exits the game. Any Ideas? And please don’t send me to another link because I have checked everywhere I could but nothing has worked :(. Thanks! :smile: :slight_smile:

This helped me to get started: Unity - Manual: IMGUI Basics

Note that Unity will introduce new UI which is mostly interface based. Look it up if you’re interested!

Thanks This Helped allot but i just need another code that exits the game :). Thanks in advance :wink:

on the start button you can do:

Application.LoadLevel("NameOfYourGameScene");

(Unity - Scripting API: Application.LoadLevel)

And for the quit button:

Application.Quit()

(Unity - Scripting API: Application.Quit)

Cheers :smile:

  • Edit Sorry i was using java script. Do you have the Quit/Exit code for js?

When you’re running your game inside of the editor, Application.Quit() won’t have any effect.
Just paste this wherever you want to quit. Have a nice day.

#if UNITY_EDITOR
UnityEditor.EditorApplication.isPlaying = false;
#elif UNITY_WEBPLAYER
Application.OpenURL(webplayerQuitURL);
#else
Application.Quit();
#endif
1 Like

It already works for JS. And +1 for what @RJ-MacReady said.