Hello everyone.
I ve being searching everywhere for a tutorial without success. so i guess here is where the answer is lying
I have 3 buttons, and i want to add a single GUIStyle and use the “Custom Style” option in GuiSkin so i can create all
3 together and be able to have different icon for normal/hoovered/active buttons.
How do i call those custom styles within a script?
using UnityEngine;
using System.Collections;
using System.IO;
public GUISkin gSkin;
void OnGUI() {
GUI.skin = gSkin;
if(ShowMenu)
{
GUI.Box(new Rect(Screen.width - 740,Screen.height - 580 , 400 , 250),"Main Menu");
if(GUI.Button(new Rect(Screen.width - 600 , Screen.height - 530 , 120 , 30) ,"Start"))
{
ShowMenu = false;
ShowStart = true;
}
if(GUI.Button(new Rect(Screen.width - 600 , Screen.height - 480 , 120 , 30) ,"Highscores"))
{
ShowScores = true;
ShowMenu = false;
HighscoreList.LoadList();
}
if(GUI.Button(new Rect(Screen.width - 600 , Screen.height - 430 , 120 , 30) ,"Exit"))
{
Application.Quit();
}
}
where it says “start” i would like to call custom style button with the name Strart_Button in Quit Quit_Button etc etc.
Everywhere it says to make seperate GuiSkins, but im sure i can call every guiStyle i need from 1 GuiSkin… or else it wouldnt make sense having the option for Custom Elements…
Can anyone help me?