- Home /
Question by
Zachary Hoffman · Apr 04, 2014 at 06:14 PM ·
javascriptguibutton
GUI Button Jagged Edges JavaScript
I want to make a GUI button with these three stages:
I tried importing their three background and writing the text in code like this:
With the code:
#pragma strict
var customSkin:GUISkin;
//button width
var buttonW:int = 100;
//button height
var buttonH:int = 50;
//half of the screen width
var halfScreenW:int;
function OnGUI() {
GUI.skin=customSkin;
if(GUI.Button(Rect(halfScreenW-buttonW/2,460,buttonW,buttonH), "Play Game")){
print("Loading game.");
Application.LoadLevel("Game");
}
}
function Start() {
halfScreenW = Screen.width/2;
}
However the button came out with jagged edges. I am not allowed to any more images so I will put a pic of it in the comments.
Comment
Nvm I fixed it. It had a preset border which was messing it up.