The Unity Toggle Toolkit

Toggle is a control that allows users to update their preferences, settings and other types of information. As such, toggles are often transitionary and short-lived, although some product-centric toggles may need to stay in place for longer. A toggle configuration change (or “toggle”) typically takes a few days at most to roll out, but can be updated as frequently as daily if needed.

Toggles are often represented by sliders that move from one state to another, and use clear, direct labels. They should also utilize visual cues to help signal state changes to the user. In particular, using high-contrast colors and ensuring that the switch position clearly signals whether an object is on or off is important. It is also essential to evaluate the societal and cultural implications of a toggle’s color and movement, since these can have significant effects on how the toggle is perceived by different audiences.

Many UI controls use toggles, and they are especially common in software. For example, the Caps Lock and Num Lock keys on a keyboard are toggles, as is the functionality of an options menu in most applications. Toggles are also common in hardware, such as cordlocks, which fasten a rope or cord by sliding a rod through a hole or eye.

The simplest toggles are on/off dynamics. When a toggle script is invoked, the targeted object is changed from its default state to the toggle’s defined state. When the toggle script is again invoked, the target returns to its default state.

More complex toggles have multiple states that can be flipped between. This is often done in a sequence, such as an animation or a series of slides in a presentation. In these cases, the toggle script receives input from a key and then follows a pre-defined list of times or objects to trigger. Toggle scripts for these types of multi-step actions are called timer triggers.

The Toggle Toolkit is a simple and modular set of Unity scripts that facilitates changing the attributes and behaviors of a scene’s objects and their interactions, without altering or modifying the original source code. The Toggle Toolkit was designed to be used by experimenters with little coding knowledge who require the ability to customize their experiments in order to collect reliable, valid data about human behavior. The Toolkit can be extended with custom scripts, and GitHub submissions are welcomed.