Custom Inspector GUI elements displaying incorrect state

You know how when you press a GUI.Button, it kinda turns dark and looks like you’re pressing it?

[CustomEditor(typeof(SkillUpgrade))]
public class SkillUpgradeEditor : Editor {
	public override void OnInspectorGUI() {
		SkillUpgrade su = target as SkillUpgrade;
		GUILayout.Button("test");
	}
}

This isn’t working for me. The button shows up, it is clickable (an if statement does trigger), but the button graphic doesn’t work.

I’ve contaminated unity’s gui before by setting a guistyle’s stuff accidentally, but that affects everything. This is only for this one type.

Amazingly, applying this exact same class to another type ([CustomEditor(typeof(SkillUpgradeManager))]) suddenly makes the button change states correctly for that other class. Not SkillUpgrade though.

This problem also extends to textfields having no visible highlight and when one is selected it types into another field. It’s basically completely impossible to use a customeditor on the type.

Has anyone had this happen before? What in the world is going on?

(This question was answered while i was typing it, but i couldn’t find an answer online. Hopefully this helps someone else)

Take a look at the other components attached to the object, try removing them one by one.

My SkillUpgrade type had a MeshFilter commponent above it in the object. Moving that component to the bottom (remove component, add component, reassign mesh) caused my GUI to respond properly.

Urgh.