Language
Edit

ToggleCollection Class

Definition

ToggleCollection groups a list of StatefulInteractables and correlates their toggle states. When any one of the StatefulInteractables are toggled, all other interactables controlled by this script will be de-toggled. A custom list of interactables can be set; if none is set at edit-time, all direct StatefulInteractable children will be added.

[UnityEngine.AddComponentMenu("MRTK/UX/Toggle Collection")]
public class ToggleCollection : UnityEngine.MonoBehaviour
[<UnityEngine.AddComponentMenu("MRTK/UX/Toggle Collection")>]
type ToggleCollection = class
    inherit MonoBehaviour
Public Class ToggleCollection
Inherits MonoBehaviour
Inheritance
UnityEngine.MonoBehaviour
ToggleCollection
Attributes
UnityEngine.AddComponentMenuAttribute

Constructors

Name Description
ToggleCollection()

Properties

Name Description
AllowSwitchOff

Get or set if the user is allowed to un-toggle the toggle buttons.

CurrentIndex

The current index in the array of stateful toggles

OnToggleSelected

This event is triggered when any of the toggles in the ToggleCollection are selected. The event data is the index of the toggle button within the ToggleCollection.

Toggles

List of StatefulInteractable toggles that will be managed by this controller.

Methods

Name Description
OnSelection(Int32)

This method is called when CurrentIndex changes.

SetSelection(Int32, Boolean)

Set the selection of a an element in the toggle collection based on index.

<param name="index">Index of an element in the ToggleCollection.</param><param name="force">Force selection to be set.</param>

Applies to