- Home /
Look like a Website Menue!
How can I create multiple buttons that look like a menu.
In other words, How can I make a navigation menu with several buttons.
Only in JavaScript please!
Thank you
Answer by alexnode · Mar 31, 2010 at 04:22 PM
Read the GUI help file here it is really easy ... you can "showMenu" with a trigger or a button or any other possible way. From the inspector you can change all the properties add images and rollover states. Here is a quick example ... you propably need to add another GUI rectangle as backdrop and more buttons and labels. Add the script to your camera or First person controller. Hope that helps.
var customButtonUP : GUIStyle; var customButtonDown : GUIStyle;
private var showMenu : boolean = true;
function OnGUI () {
if (showMenu == true)
{
if (GUI.Button (Rect (Screen.width/2,Screen.height/2 -50,100,50), "UP",customButtonUP))
{
//do your thing here
}
if (GUI.Button (Rect (Screen.width/2,Screen.height/2 + 50,100,50), "Down", customButtonDown))
{
//do your thing here
}
}
}
Dont Work, no function, only Errors, Another JavaSript Code maybe?
@$$anonymous$$andyCapy: It does work, it does function, and there are no errors.
@$$anonymous$$andyCapy hmmm create a new javascript add the code in it and drag it to your first person controller. You have to replace the "//do your thing here" with a task like "show$$anonymous$$enu = false ;" or "print ("I promise I will read the help file 100 hundred times");" !??$
Your answer
Follow this Question
Related Questions
GUI button off centre 1 Answer
Controlling Pause Menu with Keyboard 2 Answers
Close my GUI button by repressing the same Hot-key. 3 Answers
Pause Menu - Loading & Quitting 1 Answer
GUI not work after building 1 Answer