• Home
  • Documentation
  • Guides
  • FAQ
  • Get Essential UI Pack
Search Results for

    Show / Hide Table of Contents
    • LlamaSoftware.UI
      • ButtonClickSoundPlayer
      • Draggable
      • EUIPButton
      • EUIPButton.ButtonLabelStyle
      • EUIPSlider
      • EUIPSlider.DisplayFormat
      • InputFieldSliderValueDisplay
      • MenuController
      • MultiValueToggle
      • MultiValueToggleArrow
      • MultiValueToggleArrow.OnPointerUpCallback
      • Page
      • Popover
      • ProgressBar
      • ScrollViewZoomFixer
      • SliderValueDisplay
      • SliderValueSetter
      • Spinner
      • UIAnimationConstants
      • UIAnimationConstants.Direction
      • UIAnimationConstants.EntryMode
    • LlamaSoftware.UI.Tabs
      • TabbedPanel
      • TabbedPanel.ChangeTabEvent
      • TabbedPanelContent
      • TabbedPanelHeader
    • LlamaSoftware.UI.Utility
      • CornersUIGradient
      • RotatableLinearUIGradient
      • SimpleProgressBar
      • TextUpdatingProgressBar
      • UIGradientUtils
      • UIGradientUtils.Matrix2x3

    Class MultiValueToggle

    Component that supports swapping between options with left/right arrows. Fully controlled component can be configured in the inspector. You may also configure Values via the control functions of AddValue(String) and AddValues(IEnumerable<String>), or RemoveValue(String) / RemoveValues(IEnumerable<String>). It is recommended that you start from a prefab to manage via script.

    Inheritance
    System.Object
    UnityEngine.Object
    UnityEngine.Component
    UnityEngine.Behaviour
    UnityEngine.MonoBehaviour
    UnityEngine.EventSystems.UIBehaviour
    UnityEngine.UI.Selectable
    MultiValueToggle
    Implements
    UnityEngine.EventSystems.IMoveHandler
    UnityEngine.EventSystems.IPointerDownHandler
    UnityEngine.EventSystems.IPointerUpHandler
    UnityEngine.EventSystems.IPointerEnterHandler
    UnityEngine.EventSystems.IPointerExitHandler
    UnityEngine.EventSystems.ISelectHandler
    UnityEngine.EventSystems.IDeselectHandler
    UnityEngine.EventSystems.IScrollHandler
    UnityEngine.EventSystems.IEventSystemHandler
    Inherited Members
    UnityEngine.UI.Selectable.s_Selectables
    UnityEngine.UI.Selectable.s_SelectableCount
    UnityEngine.UI.Selectable.m_CurrentIndex
    UnityEngine.UI.Selectable.AllSelectablesNoAlloc(UnityEngine.UI.Selectable[])
    UnityEngine.UI.Selectable.OnCanvasGroupChanged()
    UnityEngine.UI.Selectable.IsInteractable()
    UnityEngine.UI.Selectable.OnDidApplyAnimationProperties()
    UnityEngine.UI.Selectable.OnEnable()
    UnityEngine.UI.Selectable.OnTransformParentChanged()
    UnityEngine.UI.Selectable.OnDisable()
    UnityEngine.UI.Selectable.OnValidate()
    UnityEngine.UI.Selectable.Reset()
    UnityEngine.UI.Selectable.InstantClearState()
    UnityEngine.UI.Selectable.FindSelectable(UnityEngine.Vector3)
    UnityEngine.UI.Selectable.FindSelectableOnLeft()
    UnityEngine.UI.Selectable.FindSelectableOnRight()
    UnityEngine.UI.Selectable.FindSelectableOnUp()
    UnityEngine.UI.Selectable.FindSelectableOnDown()
    UnityEngine.UI.Selectable.OnMove(UnityEngine.EventSystems.AxisEventData)
    UnityEngine.UI.Selectable.IsHighlighted()
    UnityEngine.UI.Selectable.IsPressed()
    UnityEngine.UI.Selectable.OnPointerDown(UnityEngine.EventSystems.PointerEventData)
    UnityEngine.UI.Selectable.OnPointerUp(UnityEngine.EventSystems.PointerEventData)
    UnityEngine.UI.Selectable.OnPointerEnter(UnityEngine.EventSystems.PointerEventData)
    UnityEngine.UI.Selectable.OnPointerExit(UnityEngine.EventSystems.PointerEventData)
    UnityEngine.UI.Selectable.OnSelect(UnityEngine.EventSystems.BaseEventData)
    UnityEngine.UI.Selectable.OnDeselect(UnityEngine.EventSystems.BaseEventData)
    UnityEngine.UI.Selectable.Select()
    UnityEngine.UI.Selectable.allSelectablesArray
    UnityEngine.UI.Selectable.allSelectableCount
    UnityEngine.UI.Selectable.allSelectables
    UnityEngine.UI.Selectable.navigation
    UnityEngine.UI.Selectable.transition
    UnityEngine.UI.Selectable.colors
    UnityEngine.UI.Selectable.spriteState
    UnityEngine.UI.Selectable.animationTriggers
    UnityEngine.UI.Selectable.targetGraphic
    UnityEngine.UI.Selectable.interactable
    UnityEngine.UI.Selectable.image
    UnityEngine.UI.Selectable.animator
    UnityEngine.UI.Selectable.currentSelectionState
    UnityEngine.EventSystems.UIBehaviour.Start()
    UnityEngine.EventSystems.UIBehaviour.OnDestroy()
    UnityEngine.EventSystems.UIBehaviour.IsActive()
    UnityEngine.EventSystems.UIBehaviour.OnRectTransformDimensionsChange()
    UnityEngine.EventSystems.UIBehaviour.OnBeforeTransformParentChanged()
    UnityEngine.EventSystems.UIBehaviour.OnCanvasHierarchyChanged()
    UnityEngine.EventSystems.UIBehaviour.IsDestroyed()
    Namespace: LlamaSoftware.UI
    Assembly: LlamaSoftware.UI.dll
    Syntax
    [RequireComponent(typeof(EventTrigger), typeof(Image))]
    [DisallowMultipleComponent]
    [DefaultExecutionOrder(1)]
    public class MultiValueToggle : Selectable, IMoveHandler, IPointerDownHandler, IPointerUpHandler, IPointerEnterHandler, IPointerExitHandler, ISelectHandler, IDeselectHandler, IScrollHandler, IEventSystemHandler

    Fields

    AllowWrapping

    If enabled, allows decrementing at index 0 to wrap to the highest index and incrementing at highest index to wrap to index 0

    Declaration
    public bool AllowWrapping
    Field Value
    Type Description
    System.Boolean

    BackgroundImage

    Background image for this control

    Declaration
    public Image BackgroundImage
    Field Value
    Type Description
    UnityEngine.UI.Image

    ChangeCallback

    UnityEvent to call when value changes

    Declaration
    public UnityEvent ChangeCallback
    Field Value
    Type Description
    UnityEngine.Events.UnityEvent

    DotsContainer

    Parent to spawn PreviewDotPrefabs into, if they are enabled. Expected to have the transform name of "Dots Container"

    Declaration
    public Transform DotsContainer
    Field Value
    Type Description
    UnityEngine.Transform

    EnablePreviewDots

    Whether or not to show the preview dots

    Declaration
    public bool EnablePreviewDots
    Field Value
    Type Description
    System.Boolean

    FadeSwapText

    Whether or not to fade swap in/out the text on change

    Declaration
    public bool FadeSwapText
    Field Value
    Type Description
    System.Boolean

    FadeSwapTextDuration

    Duration of time for the animation for swapping text. 0 would be the same as setting FadeSwapText to false.

    Declaration
    public float FadeSwapTextDuration
    Field Value
    Type Description
    System.Single

    KeyboardDelay

    Delay between processing left/right arrow key presses. Too low a value will increase the risk of accidental "double taps". Too high a value will make the component appear unresponsive

    Declaration
    public float KeyboardDelay
    Field Value
    Type Description
    System.Single

    NextArrow

    Next Arrow. Handles click event to increment the current index. Expected to be the third child of this component.

    Declaration
    public MultiValueToggleArrow NextArrow
    Field Value
    Type Description
    MultiValueToggleArrow

    PreviewDotPrefab

    Prefab to use to indicate number of steps there are and which is active.

    Declaration
    public Image PreviewDotPrefab
    Field Value
    Type Description
    UnityEngine.UI.Image

    PreviousArrow

    Previous arrow. Handles click event to decrement the current index. Expected to be the first child of this component.

    Declaration
    public MultiValueToggleArrow PreviousArrow
    Field Value
    Type Description
    MultiValueToggleArrow

    StartIndex

    The initial index to select (0 = first item)

    Declaration
    public int StartIndex
    Field Value
    Type Description
    System.Int32

    Text

    TextMeshPro object to display values on. Expected to be the second child of this component.

    Declaration
    public TextMeshProUGUI Text
    Field Value
    Type Description
    TMPro.TextMeshProUGUI

    Values

    Do not modify this directly, use the provided methods to interact with it. Public only for inspector. List of values to allow user to select from

    Declaration
    public List<string> Values
    Field Value
    Type Description
    System.Collections.Generic.List<System.String>

    Properties

    CurrentIndex

    Get only. The currently selected index.

    Declaration
    public int CurrentIndex { get; }
    Property Value
    Type Description
    System.Int32

    Methods

    AddValue(String)

    Adds a specific value to the list

    Declaration
    public void AddValue(string value)
    Parameters
    Type Name Description
    System.String value

    Value to add

    AddValues(IEnumerable<String>)

    Adds the specified values to the list of available values

    Declaration
    public void AddValues(IEnumerable<string> values)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<System.String> values

    Values to add

    Awake()

    Declaration
    protected override void Awake()
    Overrides
    UnityEngine.UI.Selectable.Awake()

    CanDecrement()

    Whether or not this MultiValueToggle can be decremented

    Declaration
    public bool CanDecrement()
    Returns
    Type Description
    System.Boolean

    Whether or not this MultiValueToggle can be decremented

    CanIncrement()

    Whether or not this MultiValueToggle can be incremented

    Declaration
    public bool CanIncrement()
    Returns
    Type Description
    System.Boolean

    Whether or not this MultiValueToggle can be incremented

    Decrement()

    Decrements the current index value. Call MultiValueToggle.GetCurrentValue() in your ChangeCallback, or after calling this to get the updated result.

    Declaration
    public void Decrement()

    Disable()

    Disables the MultiValueToggle

    Declaration
    public void Disable()

    DoStateTransition(Selectable.SelectionState, Boolean)

    Declaration
    protected override void DoStateTransition(Selectable.SelectionState state, bool instant)
    Parameters
    Type Name Description
    UnityEngine.UI.Selectable.SelectionState state
    System.Boolean instant
    Overrides
    UnityEngine.UI.Selectable.DoStateTransition(UnityEngine.UI.Selectable.SelectionState, System.Boolean)

    Enable()

    Enables the MultiValueToggle

    Declaration
    public void Enable()

    GetAllValues()

    Returns a copy of the list of Values

    Declaration
    public List<string> GetAllValues()
    Returns
    Type Description
    System.Collections.Generic.List<System.String>

    List of Values that can be chosen from

    GetCurrentValue()

    Returns the Value at the current index

    Declaration
    public string GetCurrentValue()
    Returns
    Type Description
    System.String

    Current Value

    Increment()

    Increments the current index value. Call MultiValueToggle.GetCurrentValue() in your ChangeCallback, or after calling this to get the updated result.

    Declaration
    public void Increment()

    OnScroll(PointerEventData)

    Callback for on scroll event from the EventTrigger. Propagates the scroll event to the parent scroll rect.

    Declaration
    public void OnScroll(PointerEventData eventData)
    Parameters
    Type Name Description
    UnityEngine.EventSystems.PointerEventData eventData

    RemoveValue(String)

    Removes a specific value from the list

    Declaration
    public void RemoveValue(string value)
    Parameters
    Type Name Description
    System.String value

    Value to remove

    RemoveValues(IEnumerable<String>)

    Removes the specified values from the list of available values

    Declaration
    public void RemoveValues(IEnumerable<string> values)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<System.String> values

    Values to remove

    SetCurrentIndex()

    Gets the active value index

    Declaration
    public int SetCurrentIndex()
    Returns
    Type Description
    System.Int32

    SetCurrentIndex(Int32)

    Sets the current index to the specified index

    Declaration
    public void SetCurrentIndex(int index)
    Parameters
    Type Name Description
    System.Int32 index

    Index to set.

    SetValue(String)

    Sets the current index to the specified value

    Declaration
    public void SetValue(string value)
    Parameters
    Type Name Description
    System.String value

    Value to set. Must be within the set of available Values

    UpdateParentScrollView(BaseEventData)

    Intended for EventTrigger use only

    Declaration
    public void UpdateParentScrollView(BaseEventData pointerEvent)
    Parameters
    Type Name Description
    UnityEngine.EventSystems.BaseEventData pointerEvent

    Pointer Event Data from the EventTrigger

    UpdateText(Int32)

    Update the inner text of the MultiValueToggle based on the current index. Will fire onChange events.

    Declaration
    public void UpdateText(int newIndex)
    Parameters
    Type Name Description
    System.Int32 newIndex

    Index of the next value to show

    Implements

    UnityEngine.EventSystems.IMoveHandler
    UnityEngine.EventSystems.IPointerDownHandler
    UnityEngine.EventSystems.IPointerUpHandler
    UnityEngine.EventSystems.IPointerEnterHandler
    UnityEngine.EventSystems.IPointerExitHandler
    UnityEngine.EventSystems.ISelectHandler
    UnityEngine.EventSystems.IDeselectHandler
    UnityEngine.EventSystems.IScrollHandler
    UnityEngine.EventSystems.IEventSystemHandler
    In This Article
    Back to top Generated by DocFX