Configuring Legacy 2D Buttons
- Last UpdatedJul 04, 2023
- 1 minute read
Buttons have peculiar characteristics compared with other 2D interface node types.
Button states
Each button has the following defined states:
-
Normal
-
Selected
-
onOver. This state is shown when the mouse is over the button but the button is not pressed.
Button children
The button node children define each button state aspect. The keys are children number and order.
|
Number |
Description |
|---|---|
|
0 children |
The button is transparent. |
|
1 child |
The first child defines all the button's visualization states. |
|
2 children |
The first child defines the normal state visualization while the second defines the clicked/selected state. No particular visualization for the onOver state (normal state displayed). |
|
3 children |
The first child defines the normal state visualization, the second defines the clicked/selected state while the third is for the onOver state. |
Guidelines for buttons
-
Although technically not an error, you should avoid setting more than three children for a button.
-
Button children are usually Rect2D or Text2D objects. However, a button child can also be a 2D node hierarchy.
-
The base behavior for buttons is stateless. A stateless button shows the onOver state when the mouse touches it and the clicked/selected only when the mouse touches while button is held.