Skip to main content

Toggler

namespace: qASIC.Toggling

Togglers

Introduction

Togglers are special scripts for toggling objects. They are often used in qASIC to support other input systems.

Creating your own Toggler

If the built in togglers aren't enough, you can create your own. By inheriting the Toggler or Static Toggler class you can change how it toggles objects.

public class ExampleToggler : Toggler
{
[KeyCodeListener] public KeyCode key;

protected override void HandleInput()
{
if (Input.GetKeyDown(key))
KeyToggle();
}
}

Toggler types

TypeDescription
TogglerBase toggler that stays in the scene.
Static TogglerToggler that moves from scene to scene.

Built in Togglers

TogglerDescription
Toggler BasicNormal Toggler that uses KeyCodes. Works with the new Unity Input System.
Toggler RemappableToggler that works with the qASIC Input System, where you can remap the button in game.
Static Toggler BasicToggler Basic that moves from scene to scene.
Static Toggler RemappableToggler Remappable that moves from scene to scene.

Toggler controllers

Introduction

These scripts are responsible for activating and controlling togglers.

Setup

Before you can use it, you'll have to make sure all of the togglers which will be used by the controller are set to the Module mode.

Built in toggler controllers

Toggler ControllerDescription
Platform Toggler ControllerThis controller uses a different toggler for different platforms. The most common use case for it is changing the pause menu key on WebGL, because the industry standard Escape minimizes the player instead of pausing.