- Home /
Question by
rambramdt · Sep 04, 2011 at 04:28 PM ·
guicustomizationstyle
Custom GUI style
hi,
I need help on customizing the build-in GUI styles. I want to use different styles for different toggle buttons, that means some will follow the default GUI.skin.toggle and others will following GUIStyle myToggle defined by myself. However, when I included the following in Start(), the toggles using myToggle were not functioning anymore.
myToggle = new GUIStyle();
myToggle.normal.textColor = Color.white;
myToggle.onNormal.textColor = Color.red;
myToggle.onHover.textColor = Color.red;
How should I do this? Your helps are greatly appreciated.
Jason
Comment
Best Answer
Answer by Waz · Sep 04, 2011 at 10:23 PM
To make a style that is the same as another style with a couple of modifications, do this:
// Construct new style from original style
myToggle = new GUIStyle(GUI.skin.toggle);
// Modify to your needs...
myToggle.normal.textColor = Color.white;
myToggle.onNormal.textColor = Color.red;
myToggle.onHover.textColor = Color.red;
Answer by Zorcian · Sep 04, 2011 at 05:39 PM
im not sure but should you try and use the update function() { //then OnGUI