The message "should not be capturing when there is a hotcontrol" in Unity refers to a situation in the Unity GUI system where an input event is being captured while there is already a "hot control" active. A hot control is a GUI control that currently has input focus, typically because the user is interacting with it (e.g., pressing a button or dragging something). When a control is hot, no other controls are supposed to capture input events. This warning usually indicates that some piece of editor or GUI code is failing to properly reset the hot control ID (active control) to 0 after the user interaction ends (like on mouseUp). As a result, input events are being wrongly captured by another control while the first control is still considered active or "hot," which can disrupt proper UI behavior, such as mouse events not reaching other controls or UI elements. In essence, the takeaway is:
- You should not be capturing input events when there is already a hot control.
- This means that if a control is active (hotControl not zero), your code should avoid capturing mouse or input events.
- Typically, the hot control gets reset once the interaction finishes (mouse button is released), allowing other controls to capture inputs again.
- If this message appears, it often points to a bug or improper state management in the handling of GUI control focus and input capturing.
This issue has persisted over years in some cases and often comes up in contexts like custom editor scripts or certain UI libraries in Unity. To fix it, ensure your GUI code correctly releases (resets) the hot control at the end of its interaction cycle before trying to capture input again on another control.