ToggleCollection Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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.MonoBehaviourToggleCollection
- 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> |