GUIControl Struct

Summary

[Editor-Only] Utility for implementing IMGUI controls.
Assembly
Animancer.dll
Namespace
Animancer.Editor
Base Types
  • ValueType
graph BT Type-->Base0["ValueType"] Type["GUIControl"] class Type type-node

Syntax

public readonly struct GUIControl : ValueType

Remarks

Example:
private static readonly int ControlHash = "ControlName".GetHashCode();

void OnGUI(Rect area)
{
    var control = new GUIControl(area, ControlHash);
    
    switch (control.EventType)
    {
        case EventType.MouseDown:
            if (control.TryUseMouseDown())
            {
            }
            break;
    
        case EventType.MouseUp:
            if (control.TryUseMouseUp())
            {
            }
            break;
    
        case EventType.MouseDrag:
            if (control.TryUseHotControl())
            {
            }
            break;
    }
}

Constructors

Name Summary
GUIControl(Rect, Event, int, FocusType) Creaates a new Animancer.Editor.GUIControl.
GUIControl(Rect, int, FocusType) Creaates a new Animancer.Editor.GUIControl with the UnityEngine.Event.current.

Fields

Name Constant Value Summary
Area
The position and size of this control
Event
The event being processed by this control.
ID
The Control ID of this control.

Properties

Name Value Summary
ContainsMousePosition bool
Does the Animancer.Editor.GUIControl.Area contain the UnityEngine.Event.mousePosition?
EventType EventType
The type of the Animancer.Editor.GUIControl.Event in relation to this control.

Methods

Name Value Summary
TryUseHotControl(bool) bool
Animancer.Editor.AnimancerGUI.TryUseHotControl(UnityEngine.Event,System.Int32,System.Boolean)
TryUseKey(KeyCode) bool
Animancer.Editor.AnimancerGUI.TryUseKey(UnityEngine.Event,System.Int32,UnityEngine.KeyCode)
TryUseMouseDown() bool
Animancer.Editor.AnimancerGUI.TryUseMouseDown(UnityEngine.Rect,UnityEngine.Event,System.Int32)
TryUseMouseUp(bool) bool
Animancer.Editor.AnimancerGUI.TryUseMouseUp(UnityEngine.Event,System.Int32,System.Boolean)