My Custom Style changes everything in the Editor, why?

Hi there,

i have one Big Problem…

I made a Customn Style for my Custom Editor Window and it works…but it changes also the Editor built in Stuff…

In my Window i want a Big Label as a Toolbar, because a Toolbar looks great, i set the Fix height to 50 and it works… but THEN, it change all Toolbars in the Editor to 50. I have no Idea why. Because i used a Custom Style…

Heres comes the code:


using UnityEngine;
using System.Collections;
using UnityEditor;

public class SHS_SpawnSystemWindow : EditorWindow {

    GUIStyle logoSHS = new GUIStyle ();
    public Texture2D logo;

    [MenuItem ("SHS/Shit SpawnSystem")]
    public static void ShowWindow ()
    {

        EditorWindow.GetWindow (typeof (SHS_SpawnSystemWindow), false);


       
    }

    void Awake ()
    {

        logo = Resources.Load ("logo_shs") as Texture2D;

    }

    void OnGUI ()
    {

        logoSHS.fontSize = 50;
        logoSHS.fontStyle = FontStyle.Bold;
        logoSHS.normal.textColor = Color.white;
        logoSHS = EditorStyles.miniButton;
        //logoSHS.fixedHeight = 80;
        logoSHS.padding = new RectOffset (0, 0, 0, 0);
        logoSHS.margin = new RectOffset (0, 0, 0, 0);

        GUI.backgroundColor = Color.black;
        EditorGUILayout.BeginVertical (logoSHS,GUILayout.Height (125));
        GUILayout.FlexibleSpace ();
        GUI.backgroundColor = Color.grey;
        EditorGUILayout.BeginHorizontal ();


        GUILayout.Label ("Shit SpawnSystem", logoSHS, GUILayout.Height (100));



        GUILayout.Label (logo, logoSHS, GUILayout.Height (100), GUILayout.Width (100));


        EditorGUILayout.EndHorizontal ();

        GUILayout.FlexibleSpace ();
        EditorGUILayout.EndVertical ();
        
        
    }
    void OnDestroy () //this was a test, but also doesn't work
    {
        logoSHS=null;
        Debug.Log ("geschlossen");
    }
}

not normal!

Probably way too late, but here is the anwser for others :

logoSHS = EditorStyles.miniButton;

logoSHS.padding = new RectOffset (0, 0, 0, 0);

logoSHS.margin = new RectOffset (0, 0, 0, 0);

Here you are giving logoSHS the same reference as EditorStyles.miniButton, so when you do :

logoSHS.padding = new RectOffset (0, 0, 0, 0)

you are in fact also doing :

EditorStyles.miniButton.padding = new RectOffset (0, 0, 0, 0)

and EditorStyles is used everywhere, so it changes everywhere :slight_smile:

What you can do is simply make a copy, like this :

logoSHS = new GUIStyle(EditorStyles.miniButton)