Hi friends.
I want to use GUISkin to customize the button, but it doesn’t seem to work. I have created the GUI Skin in Project panel and assigned it by doing drag and drop, changed some options in the Inspector. I guess there is something wrong with my code?
var lost : boolean = false;
var mygui: GUISkin;
function Update () {
if (transform.position.y < -15){
if (!lost)
{
lost = true;
}
}
}
function OnGUI()
{
GUI.skin = mygui;
if(lost)
{
var halfScreenW:float = Screen.width/2;
var halfButtonW:float = Screen.width/8;
var halfScreenH:float = Screen.height/2;
var halfButtonH:float = Screen.height/4;
if (GUI.Button(Rect(halfScreenW - halfButtonW, halfScreenH - halfButtonH, halfButtonW, halfButtonH), "Play again"))
{
Application.LoadLevel(0);
}
}
}