- Home /
Access custom style from skin via string
I am wondering if it is possible to access custom styles in my skin (i.e. the ones that are listed in "Custom Styles") through a string, like "box" or "button" for the default styles.
I would like to have something like:
GUI.Box(myRect, myContent, "customstyles/0")
or something like that, since I would like to assign styles from the skin in the inspector (without having always new instances of GUIStyle)
Answer by Statement · Mar 09, 2011 at 11:56 PM
I think you just write out the name of it, no need to supply path to it. If it's called "bob", just type in "bob".
See the manual on the topic.
// We provide the name of the Style we want to use as the last argument of the Control function
GUILayout.Button ("I am a custom styled Button", "MyCustomControl");
thought i tried it already, but it works of course -- well thanks ;)
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Setting Scroll View Width GUILayout 1 Answer
Any problems with this script? 1 Answer
Card matching game 1 Answer
GUIX remove problem 0 Answers