I’m creating a EditorWindow tool and want to refine the GUI to make more intuitive. I’ve made editorwindow tools before but for some reason can’t get this simple code to work.
I just want to draw some rects that when the region gets clicked on it changes colors to show which is selected. I’m using code like below to draw it. The “WTF!” shows up but the color doesn’t change when I hold the mousedown.
if (currentEvent.type == EventType.MouseDown)
{
Debug.Log("WTF!");
Color t = GUI.backgroundColor;
GUI.backgroundColor = Color.green;
GUI.Box(r, "");
GUI.backgroundColor = t;
Repaint();
}
else
{
GUI.Box(r, "");
}