Skip to main content

Button

The button component is a convenient shortcut for creating user interface buttons to be used with screen and element components.

The button component can be used in two transition modes. Tint which tints a single sprite with different colors for each state, or Sprite Change which uses different sprites or frames for each button state.

Common Properties

PropertyDescription
ActiveWhen enabled, the button responds to and fires events. When disabled, the button is set to inactive state.
ImageThe image element entity used to detect input events.
Hit PaddingAdditional space around the image element to be included when testing input events.
Transition ModeThe type of effect to use for transitions between states. Either Sprite Change or Tint.

Tint Properties

Tint Button

PropertyDescription
Hover TintThe color to tint the image element when the button is in hover state.
Pressed TintThe color to tint the image element when the button is in pressed state.
Inactive TintThe color to tint the image element when the button is in inactive state.
Fade DurationThe time in milliseconds to blend between different state colors.

Sprite Change Properties

Sprite Change Button

PropertyDescription
Hover SpriteThe sprite asset used when the button is in hover state.
Hover FrameThe sprite frame to display when the button is in hover state.
Pressed SpriteThe sprite asset used when the button is in pressed state.
Pressed FrameThe sprite frame to display when the button is in pressed state.
Inactive SpriteThe sprite asset used when the button is not active.
Inactive FrameThe sprite frame used when the button is not active.

Scripting Interface

You can control the button component's properties using a script component. The button component's scripting interface is here.