Skip to main content

Toggle

info
  • This class is only available in a Local environment

The Toggle class is a component which interacts with Unity Toggles on UI and 3D.

caution

The Toggle class is only compatible with TextMeshPro.

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

let toggleComponent = item.GetComponent("Toggle")

You can then use the toggleComponent property to access the Toggle class.

Methods

Method NameReturn TypeParametersDescription
GetToggleboolnoneGets the current toggle value
SetTogglevoidboolSets the current toggle value
RegisterValueChangedvoidfunction(bool)Registers an event for when the toggle value is changed
RemoveAllValuesChangedvoidnoneRemoves all events for when the toggle value is changed
GetColorBlockColorBlock?noneGets the ColorBlock for the element
SetColorBlockvoidColorBlockSets the ColorBlock for the element