Here's an example of a few button you'll typically see on a start menu.
Here is the code:
function OnGUI()
{
GUI.Button(Rect(710, 175, 300, 100), "Start Game");
GUI.Button(Rect(710, 325, 300, 100), "Options");
GUI.Button(Rect(710, 475, 300, 100), "Quit");
}
Here is a working menu in Unity, as I scroll above the titles the title will turn to red.
Here is the Script:
function OnMouseEnter(){
renderer.material.color=Color.red;
}
function OnMouseExit(){
renderer.material.color=Color.white
}
When I click on the Start Game you will be taken to a different scene where there's a cube on it's own.
In options you feel see a menu
that looks like this:
I have used the same code as my main menu to highlight the headings.
I have made use of the Help button and I'll be able to implement working buttons on the rest of the Headings to with ease.
var isOptions=false;
function OnMouseEnter(){
renderer.material.color=Color.red;
}
function OnMouseExit(){
renderer.material.color=Color.white;
}
function OnMouseUp(){
if (isQuit==true) {
Application.Quit();
}
else {
Application.LoadLevel(1);
}
}
No comments:
Post a Comment