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
-
objectObjectComponentBehaviourMonoBehaviourModularToggleGroup
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
toggleToggleBasesendCallbackbool
RegisterToggle(ToggleBase)
Register a toggle to this group.
public void RegisterToggle(ToggleBase toggle)
Parameters
toggleToggleBase
UnregisterToggle(ToggleBase)
Unregister a toggle from this group.
public void UnregisterToggle(ToggleBase toggle)
Parameters
toggleToggleBase