Game Menu

We need to build a main menu for our game which allows the user to enter some values.

Imagine the menu in Halflife where you have a main menu with “New Game”, “Options” etc. which either pull off a new menu screen or start the game.

How is this done in Unity? All the examples basically don’t have any menu, so we didn’t find any help there.

All we need basically are InputFields, Buttons and Labels.

Cheers,
Roman

Create a gui texture (Game Object → Create Other → GUI Texture).

Then you can override: OnMouseDown, OnMouseUp, MouseEnter, OnMouseExit

in a script which you attach to the same game object as the gui texture component.

http://unity3d.com/Documentation/ScriptReference/MonoBehaviour.OnMouseDown.html

For text fields you can use Input.textString:
http://unity3d.com/Documentation/ScriptReference/Input-inputString.html

I think one of the older example had an example of a script taking user input. If I get a chance, and remember, this evening I will add an example to the Wiki since it does not seem to have one.

Do check out the scripting tut on making a racing game(By David Danik-Jones), I am pretty sure theres a high scores table example where players enter their name.
AC

Actually, under the Example projects http://unity3d.com/examples/index.html, download the Old: Script Examples project. In that project take a look at the EditableGUIText.js script. It accepts input on a GUIText.