Skip to content

Toggles.md

cfloutier edited this page Apr 29, 2024 · 4 revisions

I use 2 kind of toggle in K2D2

image

K2Togggle

image

An animated Slide Toggle, i've made sollowing this tuto : https://docs.unity3d.com/Manual/UIE-slide-toggle.html

it can be used like any standard Toggle.

Binding

it can be boudn with a Setting<bool>

see Settings

ex :

 panel.Q<K2Toggle>("bool_settings").Bind(settings.bool_item);

ToggleButton

Toggle buton are square button that can be lit on/off

image

the default "on" color is green but you can change it to yellow using the uss class : .yellow

icon mode

icon mode can be used by

  • adding the icon as a child VisualElement named #icon image
  • adds an icon style class .icon to the ToggleButton
  • adds either the style, depending on the button size
    • .big image
    • .mini-toggle image

Clone this wiki locally