Table of Contents

Class ModularToggleGroup

Namespace
Fallencake.UI
Assembly
Fallencake.UI.dll

Group controller for ToggleBase elements. Ensures only one toggle is on at a time unless AllowSwitchOff is enabled.

[AddComponentMenu("Modular UI/Toggle Group", 33)]
public class ModularToggleGroup : MonoBehaviour
Inheritance
object
Object
Component
Behaviour
MonoBehaviour
ModularToggleGroup

Properties

AllowSwitchOff

Whether it is allowed that all toggles are switched off.

public bool AllowSwitchOff { get; set; }

Property Value

bool

Methods

AnyTogglesOn()

Returns true if any toggle is on.

public bool AnyTogglesOn()

Returns

bool

EnsureValidState()

Ensure that the group's state is valid according to AllowSwitchOff. If not allowed to switch off and no toggles are on, the first available will be enabled.

public void EnsureValidState()

NotifyToggleOn(ToggleBase, bool)

Notify the group that a toggle has been switched on. All other toggles will be turned off.

public void NotifyToggleOn(ToggleBase toggle, bool sendCallback = true)

Parameters

toggle ToggleBase
sendCallback bool

RegisterToggle(ToggleBase)

Register a toggle to this group.

public void RegisterToggle(ToggleBase toggle)

Parameters

toggle ToggleBase

UnregisterToggle(ToggleBase)

Unregister a toggle from this group.

public void UnregisterToggle(ToggleBase toggle)

Parameters

toggle ToggleBase