- Home /
How to include custom art/styles in editor scripts
Hi
I have seen other editor scripts use custom styles (i.e icons on buttons and such). How can I include custom art in my editor scripts without having a variable in the inspector which points to a GUISkin?
Thanks!
Answer by Molix · Dec 31, 2009 at 05:17 PM
For editor scripts, the code must be in an Editor/ folder, so place your skin in, say, the Editor/Skin folder (you'll need the exact path for the call, below).
In your editor script, you can do something like this:
public class MyEditorWindow : EditorWindow { private static GUISkin editorSkin = null;
void OnGUI() { if( editorSkin == null ) { editorSkin = (GUISkin)(Resources.LoadAssetAtPath("Assets/Editor/Skin/MyEditorSkin.guiskin", typeof(GUISkin))); } GUI.skin = editorSkin;
// go nuts
} }
Your answer
Follow this Question
Related Questions
Custom Editor GUI Elements 1 Answer
TexturePropertySingleLine in Editor class 0 Answers
Get default preview for GameObject Editor 2 Answers
How do I make a progress bar in the editor lock the background? 0 Answers
Lining up GUI 1 Answer