Resources for understanding GuiUtility.hotcontrol.

Hi All.

Is there a good explanation out there of how GuiUtility.hotcontrol works in the Unity Editor (and specifically in custom editor scripts). I’m writing my own editor and I don’t understand this area, so I want to read up on it, but I’m struggling to find much out there and the API documentation is pretty bare bones.

From what I’ve read, I have a vague notion that GuiUtility.hotcontrol is what the editor uses to identify the currently active editor control element (as in the button that your mouse is hovered over, or maybe a handle element within the scene view that has been selected?).

My custom editor has some handles in the scene view (OnSceneGui), and I’m trying to do something with the mouse drag event. However, the “Event.current” doesn’t return as “mouseDrag” (despite the fact that this is what I’m doing in the scene view) unless I manually set GuiUtility.hotcontrol = 0 on the “mouseDown” event. Whilst it’s good that I can get the mouse drag working in this way, I’d like to understand why this is the case.

Any help is appreciated.


Giving this a bump in case the person with hot hot hotcontrol knowledge hasn’t seen it.