- Home /
design menu page
hi i am alka rajput,and i am having a problem to design a menu page having play button, options,help in unity using javascript. thanks
Answer by Meltdown · Mar 27, 2011 at 05:35 PM
Hello Alka, unfortunately you will need to be more specific on what you are trying to do if you wish the community to give you a good answer :-)
What you can do is take a look at the Unity GUI reference at.. http://unity3d.com/support/documentation/ScriptReference/GUI.html
In there it will show you how to implement buttons and other screen controls within Unity.
Answer by Justin Warner · Mar 27, 2011 at 05:38 PM
When I made my main menu, I went a lot of the lines of this script:
http://www.unifycommunity.com/wiki/index.php?title=PauseMenu
Mind you, you should really use it as a template and make your own ways of doing things, and if you do completely copy and paste, it ruins the point of making a game, as you didn't make it. Guess thats ethical though, so it does differ. But I'd go off that, see what does what, take out the pause menu part, add in some stuff you think's needed, etc.
Good luck!
Answer by Xedfire 1 · Mar 27, 2011 at 05:39 PM
try this:
var boxPosition : Rect;
var boxText : String;
var levelToLoadIfPlayIsClicked : String;
private var isShowingHelp : boolean = false;
function OnGUI() {
GUILayout.BeginArea(boxPosition);
GUILayout.Box(boxText);
if(GUILayout.Button("Play"))
Application.LoadLevel(levelToLoadIfPlayIsClicked);
if(GUILayout.Button("Options"))
{
//GUI Options stuff goes here,
//I don't know what you want.
}
if(GUILayout.Button("Help"))
{
//GUI Help stuff goes here,
//I don't know what you want.
}
GUILayout.EndArea();
}
Your answer
Follow this Question
Related Questions
Music Slider hookup? 1 Answer
How to create a 2D swipe menu? 0 Answers
Basic object creation in arrays! Syntax error! 1 Answer
Why don't my purchased assets have a toolbar menu in unity? 1 Answer