Function: createButton()
createButton(
world,parent,options):Button
Defined in: ui/utilities/create-button.ts:140
Creates a button: a panel (see createPanel) with a
UiInteractableEcsComponent and a UiColorTransitionEcsComponent added,
plus a centered child label (see createLabel). There is no
ButtonEcsComponent - a button is fully described by those three parts,
each of which is independently useful and can be dropped or replaced by
building the same pieces by hand instead of calling this.
Parameters
world
The ECS world to create the button entity in.
parent
number
The parent entity - a canvas (see createUiCanvas) or
another UI element.
options
Options for configuring the button. sprite, label,
fontAtlas, and labelSize have no sensible default and must always be
provided.
Returns
The created button: its entity, its child label entity, its
UiInteractableEcsComponent, and onInvoke for the common case of
registering a single listener.