- Home /
GUIskin and c#, How?
Hi,
Im trying to get a GUIskin to work with this bit of code but it doesnt want to, The code:
public class Menu : MonoBehaviour {
float screenX = (Screen.width / 2) - 100;
float screenY = (Screen.height / 2) - 100;
public GUISkin MenuStyle;
public bool exitButtonPress = false;
public bool settingsButton = false;
public bool settingsSoundButton = false;
public bool settingsGraphicsButton = false;
public bool windowBool = Screen.fullScreen;
void OnGUI ()
{
GUI.skin = MenuStyle;
GUI.Label(new Rect((screenX + 50),25,100,30),"Game Title");
GUILayout.BeginArea(new Rect(25,25,400,400));
GUILayout.Label("test");
GUILayout.EndArea();
MenuStyle is the name of the Guiskin in Unity. But neither the GUI. or GUIlayout objects will get the style.
How is it done?
thanks.
Comment
Best Answer
Answer by Dave-Carlile · Jan 21, 2013 at 12:35 AM
How do you set the MenuStyle property? Are you assigning the skin to it in the editor?
Yeah worked it out a while ago after getting the example package (forgot I made this lol), its working fine now.
$$anonymous$$aybe you could share your solution with the rest of us so we can all learn? I created a custom GUISkin but I have no idea how to use it in my script.