Skip to main content

Button

The Button class is a component which interacts with Unity Buttons on UI and 3D.

caution

The Button class is only compatible with TextMeshPro.

To get a button from an item, use the GetComponent method.

let buttonComponent = item.GetComponent("Button")

You can then use the buttonComponent property to access the Button class.

Methods

Method NameReturn TypeParametersDescription
RegisterClickvoidfunction()Registers a click event handler
RemoveAllClicksvoidnoneRemoves all click event handlers from the button
GetColorBlockColorBlock?noneGets the ColorBlock for the element
SetColorBlockvoidColorBlockSets the ColorBlock for the element

Properties

Property NameTypeDescription
EnabledboolChecks the active state of the component