- Home /
ephemeral
EditorWindow not properly drawing
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, "");
}
Answer by ChaseRLewis73003 · Sep 24, 2012 at 07:54 AM
Figured it out. MouseDown is a oneoff event for when the mouse goes down. But doesn't fire off every frame the mouse is down.
Follow this Question
Related Questions
GUI.Window makes custom EditorWindow drag header unresponsive 2 Answers
When I pause my game and enable canvas and then resume my keyboard starts controlling the menu... 1 Answer
Can not close editor window not in GUILayout.somemethod in OnGUI method 0 Answers
How to trigger button press on a button in an editor window by pressing the return key ? 0 Answers
How to get Event.KeyboardEvent from non-focused EditorWindow? 0 Answers