- Home /
GUI Button + GUISkin = Bug, Help?
Hi, I am making a menu with gui.buttons and i have assigned them with a GUISkin. Here is my code:
public var MainMenuSkin : GUISkin; function OnGUI(){ GUI.skin = MainMenuSkin;
if(GUI.Button(Rect(Screen.width/5.5,Screen.height/5.5,250,100), "PLAY")){
Application.LoadLevel("MainScene");
}
if(GUI.Button(Rect(Screen.width/5.5, Screen.height/2.5,250,100), "HELP?")){
Application.LoadLevel("Help");
}
if(GUI.Button(Rect(Screen.width/5.5, Screen.height/1.6,250,100), "OPTIONS")){
Application.LoadLevel("Options");
}
}
I have made a GUISkin and configured it to use a button picture I designed as the background, but when I run the game the texture looks wierd. The entire button is not getting the background. Here is a picture to show you: Normally the image Ive set as background for the buttons should cover the entire 250x100 GUI.Buttons.
Does anyone have any idea of why I am experiencing this?
Answer by WillNode · Jan 03, 2015 at 08:43 PM
try to remove the blank spaces in your Button Texture and align your text properly (Using GUISkin Parameters).
Your answer
Follow this Question
Related Questions
GUISkin & Scripting 2 Answers
How to attach GUI Skin on button? 0 Answers
Changing GUI Skin button states with touch input 1 Answer
GuiSkin - Creating a 2nd button? 1 Answer
GUIContent renders button elements different from intended 0 Answers