x


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

more ▼

asked Mar 31 '10 at 03:45 PM

One-Unity-One-World gravatar image

One-Unity-One-World
1 2 2 2

(comments are locked)
10|3000 characters needed characters left

1 answer: sort oldest

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
                    }
        }
    }
more ▼

answered Mar 31 '10 at 04:22 PM

alexnode gravatar image

alexnode
984 27 32 49

Dont Work, no function, only Errors, Another JavaSript Code maybe?

Apr 01 '10 at 09:19 AM Flash-Unity3D

@MandyCapy: It does work, it does function, and there are no errors.

Apr 01 '10 at 10:07 AM Eric5h5

@MandyCapy 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 "showMenu = false ;" or "print ("I promise I will read the help file 100 hundred times");" !??$

Apr 01 '10 at 10:41 AM alexnode

Sorry dont work!

Apr 01 '10 at 12:21 PM Flash-Unity3D

and dont lokk like a Menuebar!

Apr 01 '10 at 12:22 PM Flash-Unity3D
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3691
x386
x104

asked: Mar 31 '10 at 03:45 PM

Seen: 613 times

Last Updated: Mar 31 '10 at 03:45 PM