Unity Ninja Unity 3D Forum
To have exclusive access to all downloads, recourses and links within this forum, a free registered account is required. Just a heads up Wink

You are not connected. Please login or register

Unity Ninja Unity 3D Forum » FREE Project Downloads & Recources » Scripts » Customizable Button in Unity3D {BryceCain25}

Customizable Button in Unity3D {BryceCain25}

View previous topic View next topic Go down  Message [Page 1 of 1]

1 Customizable Button in Unity3D {BryceCain25} on Wed Sep 17, 2014 10:29 pm

BryceCain25


SUPER MODERATOR
SUPER MODERATOR
The top two integers will decide the position of the buttons,
The bottom two integers will decide length and width..
WaitFor is the ammount of seconds until it loads the level..
LevelToLoad is the level to load after button click, make sure the string name is the same
as the one you added in the build settings; File -> Build Settings

Code (In JavaScript, you can name it whatever);

Code:
var CustomGUIString : String;
var WaitFor : int;
var LevelToLoad : String;
var one_ : int; //position integer
var two_ : int; //position integer
var three_ : int; //size modifier
var four_ : int; //size modifier
function Start () {

}

function Update () {

}

function OnGUI () {
if (GUI.Button(Rect(one_,two_,three_,four_),CustomGUIString)) {
waitandload();
}
}

function waitandload () {
yield WaitForSeconds(WaitFor);
Application.LoadLevel(LevelToLoad);
}

View user profile

developer23


Moderator
Moderator
Really nice Very Happy Thanks again BryceCain25! Very Happy

View user profile http://masterdevelopers.altervista.org/

BryceCain25


SUPER MODERATOR
SUPER MODERATOR
developer23 wrote:Really nice Very Happy Thanks again BryceCain25! Very Happy
Sure thing! If you can modify it, post another version! Very Happy

View user profile

View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum