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
Share
Go down
avatar
SUPER MODERATOR
SUPER MODERATOR
Posts : 279
Points : 2141
Rep : 58
Join date : 2013-12-16
Age : 17
Location : Boise Idaho United States
View user profile

Customizable Button in Unity3D {BryceCain25}

on Wed Sep 17, 2014 10:29 pm
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);
}
avatar
Moderator
Moderator
Posts : 329
Points : 2176
Rep : 43
Join date : 2014-03-12
Age : 18
Location : Italy
View user profilehttp://masterdevelopers.altervista.org/

Re: Customizable Button in Unity3D {BryceCain25}

on Thu Sep 18, 2014 5:56 am
Really nice Very Happy Thanks again BryceCain25! Very Happy
avatar
SUPER MODERATOR
SUPER MODERATOR
Posts : 279
Points : 2141
Rep : 58
Join date : 2013-12-16
Age : 17
Location : Boise Idaho United States
View user profile

Re: Customizable Button in Unity3D {BryceCain25}

on Thu Sep 18, 2014 5:58 am
Message reputation : 100% (1 vote)
developer23 wrote:Really nice Very Happy Thanks again BryceCain25! Very Happy
Sure thing! If you can modify it, post another version! Very Happy
Back to top
Permissions in this forum:
You cannot reply to topics in this forum