Custom Editor gui skin

Hi,

I’m creating a custom Editor skin, with Windows and custom inspector. I would like to change the skin of the editor.
For some element I use the relative GUI function with custom style, but I want to use my custom skin for all my component, without specify it everytime.
I try to set Gui.skin = myskin , but this change completely the GUI of unity…

And in this way I cant change the background of GUI.BeginScrollView because this method dont have a GUI.style for the content background like GUILayout.BeginScrollView.

Another thing I want to do is create the background of my Scrollview like the background of Animation component in unity, with repeated tiles.

Anyone give me a help? :slight_smile:

Do you want to do something like this?

ex:

public override void OnInspectorGUI()
    {
        GUISkin origSkin = GUI.skin;
        GUI.skin = EditorGUIUtility.GetBuiltinSkin( _isDarkSkin ? EditorSkin.Scene : EditorSkin.Inspector );
     
        //...

        GUI.skin = origSkin;
}

edit:

Yes!! Now I can load my custom skyn :slight_smile:

GUISkin oldSkin = GUI.skin;
GUI.skin = Resources.Load<GUISkin>("Skins/GraphSkin");
......
GUI.skin = oldSkin;

And what I have to do for get a background of ScrollView like this?

Take a look at http://answers.unity3d.com/questions/594855/tiling-textures-issue.html
it goes into how to tile a texture with GUI.DrawTextureWithTexCoords

I did it in this way and woorks fine! Thanks for the help :slight_smile:

Rect rectInsideScrollView = Calculation....

//Draw Internal Background Repeated
Texture2D repeatedTexture = DrimkyStyle.InsideScrollViewTexture;
for(int x = 0; x < rectInsideScrollView.width; x += repeatedTexture.width){
    for(int y = 0; y < rectInsideScrollView.height; y += repeatedTexture.height){
        GUI.DrawTextureWithTexCoords(new Rect(x, y, repeatedTexture.width, repeatedTexture.height), repeatedTexture, new Rect(0f, 0f, 1f, 1f));
    }
}
1 Like