- Home /
Changing Font, Background/Style of GUI Buttons
Hello Everyone! I am working on my Main Menu for my RPG Game and i have made 3 GUI Buttons, All three buttons work and they are in the correct position and correct size. However they are dull and boring and I really want to change the font, background or style of GUI. I want the background to be behind the text so the user can still see the text of the GUI Button. I have tried many tutorials on how to do this but i get confused on how to create the Texture, How to import it into my scene/project and then how to make it the background of my GUI button. I have found many tutorials however most of them are C# when I don't use that and I do not understand it either, So I use Javascript. Here is my Main Menu so far: var MainMenuScene: String;
function OnGUI(){
if(GUI.Button(Rect(Screen.width /2 - 100,Screen.height /2 - 50,250,50), "Main Menu")){
Application.LoadLevel(MainMenuScene);
Debug.Log("Game Started!");
}
//Make Change Graphics Quality button
if(GUI.Button(Rect(Screen.width /2 - 100,Screen.height /2 ,250,50), "Options")){
Application.LoadLevel(MainMenuScene);
Debug.Log("Options: Loaded");
}
//Make quit game button
if (GUI.Button (Rect (Screen.width /2 - 100,Screen.height /2 + 50,250,50), "Quit Game")){
Application.Quit();
Debug.Log("Game Closed!");
}
}
If anyone can tell me how i would add a texture to that then please tell me and I would very appreciate it. Also could you tell me how i would make the texture in Photoshop and how i would import it into Unity such as how big the texture would be to fit the GUI Button.
Thanks in advanced
UniqueProductionZ
P.S - I'm sorry for asking a rubbish newbie question, I'm new to Unity.
Bump, Bump, Bump. Please i really need this answered cause i have got 2 buttons red but then one of the are the default color and wont change, any ideas?
Answer by DajBuzi · Feb 12, 2014 at 06:55 PM
Check the dpcumentation about GUI Style. Documantation gives you more information than anyone can give you here.