Legacy Documentation: Version 4.6
Language: English
Button
Toggle Group

Toggle

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

The Toggle control is a checkbox that allows the user to switch an option on or off.

A Button
A Button

Properties

Property: Function:
Interactable Will this component will accept input? See Interactable.
Transition Properties that determine the way the control responds visually to user actions. See Transition Options.
Navigation Properties that determine the sequence of controls. See Navigation Options.
Is On Is the toggle switched on from the beginning?
Toggle Transition The way the toggle reacts graphically when its value is changed. The options are None (ie, the checkmark simply appears or disappears) and Fade (ie, the checkmark fades in or out).
Graphic The image used for the checkmark.
Group The Toggle Group (if any) that this Toggle belongs to.

Events

Property: Function:
On Value Changed Handles the toggle’s response when its value is changed.

Details

The Toggle control allows the user to switch an option on or off. You can also combine several toggles into a Toggle Group in cases where only one of a set of options should be on at once.

The Toggle has a single event called On Value Changed that responds when the user changes the current value. The new value is passed to the event function as a boolean parameter. Typical use cases for Toggles include:

  • Switching an option on or off (eg, playing music during a game).
  • Letting the user confirm they have read a legal disclaimer.
  • Choosing one of a set of options (eg, a day of the week) when used in a Toggle Group.
Button
Toggle Group