EditorStyles was overridden, can I revert back?

So I was creating a tool and I wanted to have a group of buttons behave like tabs.

      GUIContent content = new GUIContent();
        GUIStyle MiniLeft = EditorStyles.miniButtonLeft;
        GUIStyle MiniMid = EditorStyles.miniButtonMid;
        GUIStyle MiniRight = EditorStyles.miniButtonRight;
        GUILayoutOption[] buttonWidth =  new GUILayoutOption[]
            GUILayout.MinWidth (50),
            GUILayout.ExpandWidth (false),
public void OnGUI()
    GUILayout.BeginHorizontal ();
        content.text = "Enemies";
        content.tooltip="Edit enemies that will spawn in this level";
        MiniLeft.fontStyle = (TabState == 0)?FontStyle.Bold:FontStyle.Normal;
        if (GUILayout.Button (content,MiniLeft, buttonWidth)) 
            TabState = 0;
        content.text = "Defenses";
        content.tooltip="Edit what defenses you can build this level";
        MiniMid.fontStyle = (TabState == 1)?FontStyle.Bold:FontStyle.Normal;
        if (GUILayout.Button (content,MiniMid, buttonWidth)) 
            TabState = 1;
        content.text = "Spell";
        content.tooltip="Edit what spells you can cast this level";
        MiniRight.fontStyle = (TabState == 2)?FontStyle.Bold:FontStyle.Normal;
        if (GUILayout.Button (content,MiniRight, buttonWidth)) 
            TabState = 2;
    GUILayout.EndHorizontal ();

    TabState = Mathf.Clamp(TabState,0,2);


I assumed a line like GUIStyle MiniLeft = EditorStyles.miniButtonLeft; would simply get me a copy of the style as a new instance (similar to Vector3.one;), but the documention didn’t clarify this.
I’ve promptly switched my code to GUIStyle MiniLeft = new GUIStyle (EditorStyles.miniButtonLeft); however it seems the damage as already been done, it directly altered the style settings. so every time when I render the window I get errors like this:

NullReferenceException: Object reference not set to an instance of an object
UnityEditor.EditorStyles.get_miniButtonLeft () (at C:/buildslave/unity/build/Editor/Mono/GUI/EditorStyles.cs:69)
ChamberEditor..ctor ()
UnityEditor.WindowLayout:LoadWindowLayout(String, Boolean)

I get roughly 6 to 10 copies of that error every time the OnGUI is called and the window blanks out. I assume its a file that needs to be deleted/reverted in the Project settings and let unity remake it but I’m unsure exactly which. I would really prefer not to delete the entire folder cause resetting other settings like collision layers becomes a chore.
I am using Unity Pro version 5.1.1f1

So the question is:
Is there a way to revert back to the default EditorStyles settings?

I found what the issue was.

I had my custom styles defined and initialized outside the OnGUI call, as class variables. The class is a ScriptableObject Asset (its SubAssets has similar stylings) and the GUIStyles were with the [NonSerialized] flag( the class is [Serializable], though not sure if that matters). After running some breakpoints (and getting some sleep) I saw that my custom styles were null even though the Editor styles they copied from weren’t.

Setting them in OnEnable doesn’t work as I assume it should, but re-initalizing the styles inside the OnGUI fixed the issue. It messes with my OCD that I’m recreating the same objects more than once in a single class instance but it seems that is how it must be.

Restart the Unity editor.

The comparison with “Vector3.one” doesn’t hold since GUIStyle is a class while Vector3 is a struct. It will indeed return the reference to the GUIStyle object in memory. When you alter it you can’t revert it back unless you saved the values before you applied your changes.

However as said, no harm done. If you restart the editor, Unity will reload it’s internal GUIStyles. Just makes sure you don’t have some code around that again would mess up the internal styles.

It may be a little late, but when you directly assign values to the objects in the EditorStyles, you actually change the objects of the EditorStyles.

for example: "var test = EditorStyles.toggle;
test.label.normal.textColor = Color.Yellow; "
in here, when you try to change the text color, you are actually changing the text color in the EditorStyles content.

instead of use “var test = new GUIStyle(EditorStyles.toggle);” This kind of copies the editorstyles content.