Button events provide a generalized system for buttons and actions triggered by buttons within Resonite. This abstraction allows components to define behaviors as responses to common button interactions without having to rely on knowing which specific button was the source of the interaction. When a button event source component triggers an event, it will call all corresponding button event handler components on a single target Slot, which is usually the same one it is attached to. Button events do not traverse hierarchies in the same way Dynamic Impulses do.
Button events are separated into two categories, each defining 3 event types:
- Hover Events
- Hover Enter
- Hover Stay
- Hover Leave
- Press Events
- Pressed
- Pressing
- Released
Components that act as receivers for either or both of those event categories implement the C# interfaces IButtonPressReceiver and IButtonHoverReceiver respectively.
You can create ProtoFlux Impulses for the different event types by using the Button Events (ProtoFlux) node.
Button Event Data
Each button event carries event data with information about the interaction that resulted in the event.
Property Name | Property Type |
---|---|
Source | Type:Component |
Global Press Point | Type:Float3 |
Local Press Point | Type:Float2 |
Normalized Press Point | Type:Float2 |
Button Event Sources
Component | Hover Events | Press Events | Notes |
---|---|---|---|
Button (Component) | Yes | Yes | |
ButtonHoverEventRelay (Component) | Yes | No | Relays button hover events to a specifiable slot instead of its own slot |
ButtonPressEventRelay (Component) | No | Yes | Relays button press events to a specifiable slot instead of its own slot |
LegacyButton (Component) | No | Yes | Only supports Pressed and Released, not Pressing |
PhysicalButton (Component) | No | Yes | |
TouchButton (Component) | No | Yes |