docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class TouchSliderFloat

    A touch-optimized slider component for selecting floating-point values with support for step increments and custom formatting.

    Inheritance
    object
    CallbackEventHandler
    Focusable
    VisualElement
    BaseVisualElement
    ExVisualElement
    BaseSlider<float, float>
    TouchSlider<float>
    TouchSliderFloat
    Implements
    IEventHandler
    IResolvedStyle
    ITransform
    ITransitionAnimations
    IExperimentalFeatures
    IVisualElementScheduler
    IContextOverrideElement
    IAdditionalDataHolder
    IInputElement<float>
    IValidatableElement<float>
    INotifyValueChanging<float>
    INotifyValueChanged<float>
    IFormattable<float>
    Inherited Members
    TouchSlider<float>.ussClassName
    TouchSlider<float>.progressUssClassName
    TouchSlider<float>.labelContainerUssClassName
    TouchSlider<float>.labelUssClassName
    TouchSlider<float>.valueContainerUssClassName
    TouchSlider<float>.valueUssClassName
    TouchSlider<float>.sizeUssClassName
    TouchSlider<float>.variantUssClassName
    TouchSlider<float>.size
    TouchSlider<float>.label
    TouchSlider<float>.contentContainer
    TouchSlider<float>.SetValueWithoutNotify(float)
    TouchSlider<float>.OnTrackClicked()
    TouchSlider<float>.SetOrientation(Direction)
    TouchSlider<float>.Clamp(float, float, float)
    TouchSlider<float>.GetSizeUssClassName(Size)
    TouchSlider<float>.GetOrientationClassName(Direction)
    BaseSlider<float, float>.m_DraggerManipulator
    BaseSlider<float, float>.m_HighValue
    BaseSlider<float, float>.m_LowValue
    BaseSlider<float, float>.m_PreviousValue
    BaseSlider<float, float>.m_Value
    BaseSlider<float, float>.m_CurrentDirection
    BaseSlider<float, float>.m_ValidateValue
    BaseSlider<float, float>.m_Orientation
    BaseSlider<float, float>.m_Step
    BaseSlider<float, float>.m_ShiftStep
    BaseSlider<float, float>.m_SwapThumbs
    BaseSlider<float, float>.m_FormatString
    BaseSlider<float, float>.m_FormatFunc
    BaseSlider<float, float>.m_DraggedThumbIndex
    BaseSlider<float, float>.lowValue
    BaseSlider<float, float>.highValue
    BaseSlider<float, float>.SetValueWithoutNotify(float)
    BaseSlider<float, float>.value
    BaseSlider<float, float>.formatString
    BaseSlider<float, float>.formatFunction
    BaseSlider<float, float>.invalid
    BaseSlider<float, float>.validateValue
    BaseSlider<float, float>.orientation
    BaseSlider<float, float>.step
    BaseSlider<float, float>.shiftStep
    BaseSlider<float, float>.swapThumbs
    BaseSlider<float, float>.comparer
    BaseSlider<float, float>.thumbComparer
    BaseSlider<float, float>.OnSliderRangeChanged()
    BaseSlider<float, float>.SetOrientation(Direction)
    BaseSlider<float, float>.SetStep(float)
    BaseSlider<float, float>.SetShiftStep(float)
    BaseSlider<float, float>.SetSwapThumbs(bool)
    BaseSlider<float, float>.InvokeValueChangedCallbacks()
    BaseSlider<float, float>.OnGeometryChanged(GeometryChangedEvent)
    BaseSlider<float, float>.OnStyleResolved(CustomStyleResolvedEvent)
    BaseSlider<float, float>.OnDirectionChanged(ContextChangedEvent<DirContext>)
    BaseSlider<float, float>.OnTrackUp(Draggable)
    BaseSlider<float, float>.OnTrackDown(Draggable)
    BaseSlider<float, float>.OnTrackDragged(Draggable)
    BaseSlider<float, float>.GetTrackElement()
    BaseSlider<float, float>.ComputeValueFromDrag(Draggable)
    BaseSlider<float, float>.GetNormalizedValueFromDrag(Draggable)
    BaseSlider<float, float>.FindClosestThumbValue(Draggable, ReadOnlySpan<float>, out int)
    BaseSlider<float, float>.FindClosestThumbValue(float, ReadOnlySpan<float>, out int)
    BaseSlider<float, float>.FindClosestThumbValue(float, int, Func<int, float>, out int)
    BaseSlider<float, float>.OnKeyDown(KeyDownEvent)
    BaseSlider<float, float>.OnTrackClicked()
    BaseSlider<float, float>.GetClampedValue(float)
    BaseSlider<float, float>.KeyDecrement(float, float, KeyDownEvent)
    BaseSlider<float, float>.KeyIncrement(float, float, KeyDownEvent)
    BaseSlider<float, float>.Clamp(float, float, float)
    BaseSlider<float, float>.thumbCount
    BaseSlider<float, float>.GetValueFromScalarValues(Span<float>)
    BaseSlider<float, float>.GetScalarValuesFromValue(float, Span<float>)
    BaseSlider<float, float>.ClampThumb(float, float, float)
    BaseSlider<float, float>.ParseValueToString(float)
    BaseSlider<float, float>.ParseRawValueToString(float)
    BaseSlider<float, float>.ParseSubValueToString(float)
    BaseSlider<float, float>.ParseStringToValue(string, out float)
    BaseSlider<float, float>.SliderLerpUnclamped(float, float, float)
    BaseSlider<float, float>.SliderNormalizeValue(float, float, float)
    BaseSlider<float, float>.Mad(int, float, float)
    BaseSlider<float, float>.GetStepCount(float)
    ExVisualElement.outlineColor
    ExVisualElement.backgroundColor
    ExVisualElement.passMask
    BaseVisualElement.contextPrefix
    BaseVisualElement.scaleOverride
    BaseVisualElement.themeOverride
    BaseVisualElement.langOverride
    BaseVisualElement.layoutDirectionOverride
    BaseVisualElement.preferredTooltipPlacementOverride
    BaseVisualElement.tooltipDelayMsOverride
    BaseVisualElement.GetLayoutDirectionUssClassName(Dir)
    VisualElement.disabledUssClassName
    VisualElement.SetActivePseudoState(bool)
    VisualElement.SetCheckedPseudoState(bool)
    VisualElement.Focus()
    VisualElement.SendEvent(EventBase)
    VisualElement.SetEnabledFromHierarchy(bool)
    VisualElement.SetEnabled(bool)
    VisualElement.MarkDirtyRepaint()
    VisualElement.IsMarkedForRepaint()
    VisualElement.ContainsPoint(Vector2)
    VisualElement.Overlaps(Rect)
    VisualElement.DoMeasure(float, VisualElement.MeasureMode, float, VisualElement.MeasureMode)
    VisualElement.ToString()
    VisualElement.GetClasses()
    VisualElement.ClearClassList()
    VisualElement.AddToClassList(string)
    VisualElement.RemoveFromClassList(string)
    VisualElement.ToggleInClassList(string)
    VisualElement.EnableInClassList(string, bool)
    VisualElement.ClassListContains(string)
    VisualElement.FindAncestorUserData()
    VisualElement.SetBinding(BindingId, Binding)
    VisualElement.GetBinding(BindingId)
    VisualElement.TryGetBinding(BindingId, out Binding)
    VisualElement.GetBindingInfos()
    VisualElement.GetBindingInfos(List<BindingInfo>)
    VisualElement.HasBinding(BindingId)
    VisualElement.ClearBinding(BindingId)
    VisualElement.ClearBindings()
    VisualElement.GetHierarchicalDataSourceContext()
    VisualElement.GetDataSourceContext(BindingId)
    VisualElement.TryGetDataSourceContext(BindingId, out DataSourceContext)
    VisualElement.TryGetLastBindingToUIResult(in BindingId, out BindingResult)
    VisualElement.TryGetLastBindingToSourceResult(in BindingId, out BindingResult)
    VisualElement.Add(VisualElement)
    VisualElement.Insert(int, VisualElement)
    VisualElement.Remove(VisualElement)
    VisualElement.RemoveAt(int)
    VisualElement.Clear()
    VisualElement.ElementAt(int)
    VisualElement.IndexOf(VisualElement)
    VisualElement.Children()
    VisualElement.Sort(Comparison<VisualElement>)
    VisualElement.BringToFront()
    VisualElement.SendToBack()
    VisualElement.PlaceBehind(VisualElement)
    VisualElement.PlaceInFront(VisualElement)
    VisualElement.RemoveFromHierarchy()
    VisualElement.GetFirstOfType<T>()
    VisualElement.GetFirstAncestorOfType<T>()
    VisualElement.Contains(VisualElement)
    VisualElement.FindCommonAncestor(VisualElement)
    VisualElement.viewDataKey
    VisualElement.userData
    VisualElement.canGrabFocus
    VisualElement.focusController
    VisualElement.disablePlayModeTint
    VisualElement.usageHints
    VisualElement.transform
    VisualElement.scaledPixelsPerPoint
    VisualElement.layout
    VisualElement.contentRect
    VisualElement.paddingRect
    VisualElement.worldBound
    VisualElement.localBound
    VisualElement.worldTransform
    VisualElement.hasActivePseudoState
    VisualElement.hasInactivePseudoState
    VisualElement.hasHoverPseudoState
    VisualElement.hasCheckedPseudoState
    VisualElement.hasEnabledPseudoState
    VisualElement.hasDisabledPseudoState
    VisualElement.hasFocusPseudoState
    VisualElement.hasRootPseudoState
    VisualElement.pickingMode
    VisualElement.name
    VisualElement.enabledInHierarchy
    VisualElement.enabledSelf
    VisualElement.languageDirection
    VisualElement.visible
    VisualElement.generateVisualContent
    VisualElement.dataSource
    VisualElement.dataSourcePath
    VisualElement.dataSourceType
    VisualElement.experimental
    VisualElement.hierarchy
    VisualElement.cacheAsBitmap
    VisualElement.parent
    VisualElement.panel
    VisualElement.visualTreeAssetSource
    VisualElement.this[int]
    VisualElement.childCount
    VisualElement.schedule
    VisualElement.style
    VisualElement.resolvedStyle
    VisualElement.customStyle
    VisualElement.styleSheets
    VisualElement.tooltip
    Focusable.Blur()
    Focusable.focusable
    Focusable.tabIndex
    Focusable.delegatesFocus
    CallbackEventHandler.RegisterCallback<TEventType>(EventCallback<TEventType>, TrickleDown)
    CallbackEventHandler.RegisterCallbackOnce<TEventType>(EventCallback<TEventType>, TrickleDown)
    CallbackEventHandler.RegisterCallback<TEventType, TUserArgsType>(EventCallback<TEventType, TUserArgsType>, TUserArgsType, TrickleDown)
    CallbackEventHandler.RegisterCallbackOnce<TEventType, TUserArgsType>(EventCallback<TEventType, TUserArgsType>, TUserArgsType, TrickleDown)
    CallbackEventHandler.RegisterCallback<TEventType>(EventCallback<TEventType>, CallbackOptions)
    CallbackEventHandler.RegisterCallback<TEventType, TUserArgsType>(EventCallback<TEventType, TUserArgsType>, TUserArgsType, CallbackOptions)
    CallbackEventHandler.UnregisterCallback<TEventType>(EventCallback<TEventType>, TrickleDown)
    CallbackEventHandler.UnregisterCallback<TEventType>(EventCallback<TEventType>, CallbackOptions)
    CallbackEventHandler.UnregisterCallback<TEventType, TUserArgsType>(EventCallback<TEventType, TUserArgsType>, TrickleDown)
    CallbackEventHandler.UnregisterCallback<TEventType, TUserArgsType>(EventCallback<TEventType, TUserArgsType>, CallbackOptions)
    CallbackEventHandler.UnregisterAllRemovableCallbacks()
    CallbackEventHandler.HasTrickleDownHandlers()
    CallbackEventHandler.HasBubbleUpHandlers()
    CallbackEventHandler.ExecuteDefaultActionAtTarget(EventBase)
    CallbackEventHandler.HandleEventBubbleUp(EventBase)
    CallbackEventHandler.HandleEventTrickleDown(EventBase)
    CallbackEventHandler.ExecuteDefaultAction(EventBase)
    CallbackEventHandler.NotifyPropertyChanged(in BindingId)
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: Unity.AppUI.UI
    Assembly: Unity.AppUI.dll
    Syntax
    [UxmlElement]
    public class TouchSliderFloat : TouchSlider<float>, IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, IContextOverrideElement, IAdditionalDataHolder, IInputElement<float>, IValidatableElement<float>, INotifyValueChanging<float>, INotifyValueChanged<float>, IFormattable<float>
    Remarks

    TouchSliderFloat is a touch-optimized slider component that allows users to select a floating-point value from a defined range. It supports both touch and keyboard interactions, making it suitable for touch devices while maintaining accessibility.

    The component features a visual track with a progress indicator, customizable step increments, shift-key modifier for larger steps, and support for value formatting. It can be oriented horizontally or vertically and adapts to RTL (Right-to-Left) layouts automatically.

    For optimal touch interaction, the slider defaults to a medium size that provides an adequately sized touch target. You can adjust the size using the size property to match your UI requirements.

    The slider supports both UXML definition and runtime instantiation, making it flexible for various UI development workflows.

    Examples

    Basic slider with default settings — creates a basic horizontal slider with default range (0-1) and initial value of 0.5.

    <TouchSliderFloat value="0.5" />

    Customized slider with specific range and step values — creates a large slider with a range from -10 to 10, 0.5 step increments, 2.0 shift-step, and one decimal place formatting.

    <TouchSliderFloat
        low-value="-10"
        high-value="10"
        value="0"
        step="0.5"
        shift-step="2.0"
        format-string="F1"
        size="L"
    />

    Vertical slider with custom styling — creates a vertical slider with a range from 0 to 100 and custom styling class.

    <TouchSliderFloat
        orientation="Vertical"
        low-value="0"
        high-value="100"
        value="50"
        class="custom-slider"
    />

    Runtime instantiation and event handling — creates a slider in code, configures it to display values as percentages, and handles value changes.

    var slider = new TouchSliderFloat();
    slider.lowValue = 0f;
    slider.highValue = 1f;
    slider.value = 0.5f;
    slider.formatString = "P0";
    slider.RegisterValueChangedCallback(evt => {
        Debug.Log($"New value: {evt.newValue}");
    });

    Constructors

    TouchSliderFloat()

    Default constructor.

    Declaration
    public TouchSliderFloat()

    Properties

    thumbCount

    Get the number of thumbs for this slider.

    Declaration
    protected override int thumbCount { get; }
    Property Value
    Type Description
    int
    Overrides
    BaseSlider<float, float>.thumbCount

    Methods

    ClampThumb(float, float, float)

    Clamp the thumb value.

    Declaration
    protected override float ClampThumb(float x, float min, float max)
    Parameters
    Type Name Description
    float x

    The value to clamp.

    float min

    The minimum value.

    float max

    The maximum value.

    Returns
    Type Description
    float

    The clamped values.

    Overrides
    BaseSlider<float, float>.ClampThumb(float, float, float)

    GetScalarValuesFromValue(float, Span<float>)

    Get the list of thumb values from the TValue value. This must be sorted.

    Declaration
    protected override void GetScalarValuesFromValue(float v, Span<float> values)
    Parameters
    Type Name Description
    float v
    Span<float> values

    The list of thumb values.

    Overrides
    BaseSlider<float, float>.GetScalarValuesFromValue(float, Span<float>)

    GetStepCount(float)

    Get the number of possible steps between the lowValue and highValue.

    Declaration
    protected override int GetStepCount(float stepValue)
    Parameters
    Type Name Description
    float stepValue

    The step value.

    Returns
    Type Description
    int

    The number of possible steps.

    Overrides
    BaseSlider<float, float>.GetStepCount(float)

    GetValueFromScalarValues(Span<float>)

    Get the TValue value from the list of thumb values.

    Declaration
    protected override float GetValueFromScalarValues(Span<float> values)
    Parameters
    Type Name Description
    Span<float> values

    The list of thumb values.

    Returns
    Type Description
    float

    The TValue value.

    Overrides
    BaseSlider<float, float>.GetValueFromScalarValues(Span<float>)

    Mad(int, float, float)

    Performs an arithmetic multiply/add operation.

    Declaration
    protected override float Mad(int m, float a, float b)
    Parameters
    Type Name Description
    int m

    The number of times to multiply the a value.

    float a

    The value that will be multiplied N times and then added to the base value.

    float b

    The addition value.

    Returns
    Type Description
    float

    The incremented value.

    Overrides
    BaseSlider<float, float>.Mad(int, float, float)

    ParseRawValueToString(float)

    Method to implement to resolve a float value into a string value.

    Declaration
    protected override string ParseRawValueToString(float val)
    Parameters
    Type Name Description
    float val

    The float value to convert.

    Returns
    Type Description
    string

    The converted value.

    Overrides
    BaseSlider<float, float>.ParseRawValueToString(float)
    Remarks

    This method is used to convert the value to a string when the user is editing the value in the input field. This must not use the formatString property.

    ParseStringToValue(string, out float)

    Method to implement to resolve a string value into a float value.

    You can use TryParse(string, out float) for floating point value types for example.

    Declaration
    protected override bool ParseStringToValue(string strValue, out float val)
    Parameters
    Type Name Description
    string strValue

    The string value to convert.

    float val
    Returns
    Type Description
    bool

    True if can be parsed, False otherwise.

    Overrides
    BaseSlider<float, float>.ParseStringToValue(string, out float)

    ParseSubValueToString(float)

    Method to implement to resolve a float value into a string value.

    You can use ToString() for floating point value types for example.

    You can also round the value if you want a specific number of decimals.

    Declaration
    protected override string ParseSubValueToString(float val)
    Parameters
    Type Name Description
    float val

    The float value to convert.

    Returns
    Type Description
    string

    The converted value.

    Overrides
    BaseSlider<float, float>.ParseSubValueToString(float)

    ParseValueToString(float)

    Method to implement to resolve a float value into a string value.

    You can use ToString() for floating point value types for example.

    You can also round the value if you want a specific number of decimals.

    Declaration
    protected override string ParseValueToString(float val)
    Parameters
    Type Name Description
    float val

    The float value to convert.

    Returns
    Type Description
    string

    The converted value.

    Overrides
    BaseSlider<float, float>.ParseValueToString(float)

    SliderLerpUnclamped(float, float, float)

    Method to implement which returns a value based on the linear interpolation of a given interpolant between a specific range.

    Usually, you can use directly LerpUnclamped(float, float, float) for floating point value types.

    Declaration
    protected override float SliderLerpUnclamped(float a, float b, float interpolant)
    Parameters
    Type Name Description
    float a

    The lowest value in the range.

    float b

    The highest value in the range.

    float interpolant

    The normalized value to process.

    Returns
    Type Description
    float

    The interpolated value.

    Overrides
    BaseSlider<float, float>.SliderLerpUnclamped(float, float, float)

    SliderNormalizeValue(float, float, float)

    Method to implement which returns the normalized value of a given value in a specific range.

    Usually, you can use directly an InverseLerp(float, float, float) for floating point value types.

    Declaration
    protected override float SliderNormalizeValue(float currentValue, float lowerValue, float higherValue)
    Parameters
    Type Name Description
    float currentValue

    The value to normalize.

    float lowerValue

    The lowest value in the range.

    float higherValue

    The highest value in the range.

    Returns
    Type Description
    float

    The normalized value.

    Overrides
    BaseSlider<float, float>.SliderNormalizeValue(float, float, float)

    Implements

    IEventHandler
    IResolvedStyle
    ITransform
    ITransitionAnimations
    IExperimentalFeatures
    IVisualElementScheduler
    IContextOverrideElement
    IAdditionalDataHolder
    IInputElement<TValue>
    IValidatableElement<TValue>
    INotifyValueChanging<TValue>
    INotifyValueChanged<T>
    IFormattable<TValue>

    Extension Methods

    NotifyValueChangingExtensions.RegisterValueChangingCallback<TValue>(INotifyValueChanging<TValue>, EventCallback<ChangingEvent<TValue>>)
    NotifyValueChangingExtensions.UnregisterValueChangingCallback<TValue>(INotifyValueChanging<TValue>, EventCallback<ChangingEvent<TValue>>)
    VisualElementExtensions.FindNavController(VisualElement)
    RegisterUpdateCallbackExtensions.RegisterUpdateCallback(VisualElement, EventCallback<UpdateEvent>)
    RegisterUpdateCallbackExtensions.UnregisterUpdateCallback(VisualElement, EventCallback<UpdateEvent>)
    VisualElementExtensions.EnableDynamicTransform(VisualElement, bool)
    VisualElementExtensions.EnablePicking(VisualElement, bool)
    VisualElementExtensions.GetChildren<T>(VisualElement, bool)
    VisualElementExtensions.GetContextProvider<T>(VisualElement)
    VisualElementExtensions.GetContextProvider<T>(VisualElement, string)
    VisualElementExtensions.GetContext<T>(VisualElement)
    VisualElementExtensions.GetContext<T>(VisualElement, string)
    VisualElementExtensions.GetExclusiveRootElement(VisualElement)
    VisualElementExtensions.GetLastAncestorOfType<T>(VisualElement)
    VisualElementExtensions.GetPreferredTooltipPlacement(VisualElement)
    VisualElementExtensions.GetSelfContext<T>(VisualElement)
    VisualElementExtensions.GetSelfContext<T>(VisualElement, string)
    VisualElementExtensions.GetTooltipContent(VisualElement)
    VisualElementExtensions.GetTooltipTemplate(VisualElement)
    VisualElementExtensions.HasAncestorOfType<T>(VisualElement, bool)
    VisualElementExtensions.HasAncestorsOfType<T>(VisualElement)
    VisualElementExtensions.IsContextProvider<T>(VisualElement)
    VisualElementExtensions.IsContextProvider<T>(VisualElement, string)
    VisualElementExtensions.IsInvisible(VisualElement)
    VisualElementExtensions.IsOnScreen(VisualElement)
    VisualElementExtensions.ProvideContext<T>(VisualElement, string, T)
    VisualElementExtensions.ProvideContext<T>(VisualElement, T)
    VisualElementExtensions.RegisterContextChangedCallback<T>(VisualElement, string, EventCallback<ContextChangedEvent<T>>)
    VisualElementExtensions.RegisterContextChangedCallback<T>(VisualElement, EventCallback<ContextChangedEvent<T>>)
    VisualElementExtensions.SetPreferredTooltipPlacement(VisualElement, OptionalEnum<PopoverPlacement>)
    VisualElementExtensions.SetTooltipContent(VisualElement, VisualElementExtensions.TooltipContentCallback)
    VisualElementExtensions.SetTooltipTemplate(VisualElement, VisualElement)
    VisualElementExtensions.UnregisterContextChangedCallback<T>(VisualElement, string, EventCallback<ContextChangedEvent<T>>)
    VisualElementExtensions.UnregisterContextChangedCallback<T>(VisualElement, EventCallback<ContextChangedEvent<T>>)
    In This Article
    Back to top
    Copyright © 2026 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)