Posted by : JoGamerWorld
sábado, 6 de abril de 2013
Aqui um script para menu principal, pode ser aplicado em qualquer GameObject do Unity 3D.
Here a script for main menu. Can be applied to any GameObject in Unity 3D.
O Script é auto explicativo copie ou baixe.
The script is self explanatory copy or download.
The script is self explanatory copy or download.
- //tamanho
- var TelaH: float;
- var TelaW: float;
- //posição
- var PosX : float;
- var Posy : float;
- //GUISkins
- var GuiSkin: GUISkin;
- var fundoMenu: GUISkin;
- function Start () {
- TelaH=Screen.height-Screen.height; // = 0
- TelaW=Screen.width-Screen.width; // = 0
- PosX=Screen.width-Screen.width; // = 0
- PosY=Screen.height-Screen.height; // = 0
- }
- function Update () {
- }
- function OnGUI () {
- //fundo do Menu
- GUI.skin=fundoMenu;
- GUI.Box (Rect (PosX,PosY,Screen.width,Screen.height), " ");
- //Botoes
- GUI.skin=GuiSkin; //V-nome do botão-V//
- if (GUI.Button (Rect (25, 25, 100, 30), "Iniciar")) {
- /* Botar o que vai acontecer quando o botão for clicado.
- No nosso caso vamos fazer ir a cena do jogo ou fazer sair do jogo*/
- Application.LoadLevel("..nome da cena.."); /* ou Application.Quit();*/
- }
- }
Ele funciona no celular?
ResponderExcluir