Switch
Toggle switch that activates/deactivates on use.
Introduction
Switch is a mechanical lever that flips between ON and OFF, and it is the classic companion of doors, lamps, and anything that should listen to a player’s choice. The Switch component panel in the Uni editor Image The Switch component panel in the Object editor. caption
How to Access
Select an object, open the Properties Panel, then press the Add Component button at the bottom and pick Switch. The component stacks onto the object as a new accordion of properties. How to Access - Add Component in the Properties Panel
Another Way to Access
Shortcut: open the Asset Panel, go to the Device tab, Basic category, and click the Switch block. The editor spawns a cube with Switch already attached, ready to adjust. How to Access - the Switch block in Asset Panel > Device > Basic
Properties
Default Enum Whether the switch starts On or Off. The Edit button lets you restyle the model for both states. Auto Reset Bool Makes the switch flip back to its original position by itself. Reset Time Float How long it waits before auto-resetting. Only matters when Auto Reset is on. Interact Text On String The interaction label shown while the switch is on. Interact Text Off The interaction label shown while the switch is off. Output Channel Channel The old signal line for the switch state. No longer maintained. Use Events and scripting instead. Property Type Description Every property on the Switch component.
Events
When Button Down Fires when the switch changes to the ON state, shown in the editor as the "when switch turn on" event block. Player: the player who flipped it When Button UP Fires when the switch changes to the OFF state, shown in the editor as the "when switch turn off" event block.
Commands
Switch has no commands.
Example
A switch moves a cube up when turned on and back down when turned off. Switch - Simple video