docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class BaseSlider<TValue, TScalar>

    Base class for any kind of Slider such as TouchSliderFloat, SliderFloat or RangeSliderFloat.

    Inheritance
    object
    CallbackEventHandler
    Focusable
    VisualElement
    BaseVisualElement
    ExVisualElement
    BaseSlider<TValue, TScalar>
    Slider<TValue, TScalar, TInputField>
    TouchSlider<TValue>
    Implements
    IEventHandler
    ITransform
    ITransitionAnimations
    IExperimentalFeatures
    IVisualElementScheduler
    IResolvedStyle
    IContextOverrideElement
    IAdditionalDataHolder
    IInputElement<TValue>
    IValidatableElement<TValue>
    INotifyValueChanging<TValue>
    INotifyValueChanged<TValue>
    IFormattable<TScalar>
    Inherited Members
    ExVisualElement.contentContainer
    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.ExecuteDefaultAction(EventBase)
    VisualElement.Focus()
    VisualElement.SendEvent(EventBase)
    VisualElement.SetEnabledFromHierarchy(bool)
    VisualElement.SetEnabled(bool)
    VisualElement.MarkDirtyRepaint()
    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.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.usageHints
    VisualElement.transform
    VisualElement.layout
    VisualElement.contentRect
    VisualElement.paddingRect
    VisualElement.worldBound
    VisualElement.localBound
    VisualElement.worldTransform
    VisualElement.pickingMode
    VisualElement.name
    VisualElement.enabledInHierarchy
    VisualElement.enabledSelf
    VisualElement.visible
    VisualElement.generateVisualContent
    VisualElement.experimental
    VisualElement.hierarchy
    VisualElement.cacheAsBitmap
    VisualElement.parent
    VisualElement.panel
    VisualElement.visualTreeAssetSource
    VisualElement.this[int]
    VisualElement.childCount
    VisualElement.schedule
    VisualElement.style
    VisualElement.customStyle
    VisualElement.styleSheets
    VisualElement.tooltip
    VisualElement.resolvedStyle
    Focusable.Blur()
    Focusable.focusable
    Focusable.tabIndex
    Focusable.delegatesFocus
    CallbackEventHandler.RegisterCallback<TEventType>(EventCallback<TEventType>, TrickleDown)
    CallbackEventHandler.RegisterCallback<TEventType, TUserArgsType>(EventCallback<TEventType, TUserArgsType>, TUserArgsType, TrickleDown)
    CallbackEventHandler.UnregisterCallback<TEventType>(EventCallback<TEventType>, TrickleDown)
    CallbackEventHandler.UnregisterCallback<TEventType, TUserArgsType>(EventCallback<TEventType, TUserArgsType>, TrickleDown)
    CallbackEventHandler.HandleEvent(EventBase)
    CallbackEventHandler.HasTrickleDownHandlers()
    CallbackEventHandler.HasBubbleUpHandlers()
    CallbackEventHandler.ExecuteDefaultActionAtTarget(EventBase)
    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
    public abstract class BaseSlider<TValue, TScalar> : ExVisualElement, IEventHandler, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, IResolvedStyle, IContextOverrideElement, IAdditionalDataHolder, IInputElement<TValue>, IValidatableElement<TValue>, INotifyValueChanging<TValue>, INotifyValueChanged<TValue>, IFormattable<TScalar> where TScalar : unmanaged
    Type Parameters
    Name Description
    TValue

    A value type for the slider.

    TScalar

    A value type for a single thumb of the slider.

    Constructors

    BaseSlider()

    Default constructor.

    Declaration
    protected BaseSlider()
    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    Fields

    m_CurrentDirection

    The current direction of the layout.

    Declaration
    protected Dir m_CurrentDirection
    Field Value
    Type Description
    Dir
    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    m_DraggedThumbIndex

    The current thumb index that is being dragged.

    Declaration
    protected int m_DraggedThumbIndex
    Field Value
    Type Description
    int
    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    m_DraggerManipulator

    The dragger manipulator used to move the slider.

    Declaration
    protected Draggable m_DraggerManipulator
    Field Value
    Type Description
    Draggable
    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    m_FormatFunc

    The format function used to display the value of the slider.

    Declaration
    protected FormatFunction<TScalar> m_FormatFunc
    Field Value
    Type Description
    FormatFunction<TScalar>
    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    m_FormatString

    The format string used to display the value of the slider.

    Declaration
    protected string m_FormatString
    Field Value
    Type Description
    string
    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    m_HighValue

    Slider max value.

    Declaration
    protected TScalar m_HighValue
    Field Value
    Type Description
    TScalar
    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    m_LowValue

    Slider min value.

    Declaration
    protected TScalar m_LowValue
    Field Value
    Type Description
    TScalar
    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    m_Orientation

    The orientation of the slider.

    Declaration
    protected Direction m_Orientation
    Field Value
    Type Description
    Direction
    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    m_PreviousValue

    The previous value of the slider before the user started interacting with it.

    Declaration
    protected TValue m_PreviousValue
    Field Value
    Type Description
    TValue
    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    m_ShiftStep

    The shift step value of the slider.

    Declaration
    protected TScalar m_ShiftStep
    Field Value
    Type Description
    TScalar
    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    m_Step

    The step value of the slider.

    Declaration
    protected TScalar m_Step
    Field Value
    Type Description
    TScalar
    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    m_SwapThumbs

    Whether the thumbs can be swapped if the low value is greater than the high value. If false, each thumb will be clamped to its respective value.

    Declaration
    protected bool m_SwapThumbs
    Field Value
    Type Description
    bool
    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    m_ValidateValue

    The validation function used to validate the value of the slider.

    Declaration
    protected Func<TValue, bool> m_ValidateValue
    Field Value
    Type Description
    Func<TValue, bool>
    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    m_Value

    The current value of the slider.

    Declaration
    protected TValue m_Value
    Field Value
    Type Description
    TValue
    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    Properties

    comparer

    The comparer used to compare the values of the slider.

    Declaration
    public IComparer<TValue> comparer { get; set; }
    Property Value
    Type Description
    IComparer<TValue>
    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    formatFunction

    The format function used to display the value of the slider.

    Declaration
    public FormatFunction<TScalar> formatFunction { get; set; }
    Property Value
    Type Description
    FormatFunction<TScalar>
    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    formatString

    The format string used to display the value of the slider.

    Declaration
    public string formatString { get; set; }
    Property Value
    Type Description
    string
    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    highValue

    Specify the maximum value in the range of this slider.

    Declaration
    public TScalar highValue { get; set; }
    Property Value
    Type Description
    TScalar
    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    invalid

    The invalid state of the slider.

    Declaration
    public bool invalid { get; set; }
    Property Value
    Type Description
    bool
    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    lowValue

    Specify the minimum value in the range of this slider.

    Declaration
    public TScalar lowValue { get; set; }
    Property Value
    Type Description
    TScalar
    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    orientation

    The orientation of the slider. It can be horizontal or vertical. In vertical orientation, the slider will be drawn from bottom to top. In horizontal orientation, the slider will be drawn from left to right in LTR context and from right to left in RTL context.

    Declaration
    public Direction orientation { get; set; }
    Property Value
    Type Description
    Direction
    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    shiftStep

    The step value of the slider when the shift key is pressed.

    Declaration
    public TScalar shiftStep { get; set; }
    Property Value
    Type Description
    TScalar
    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    step

    The step value of the slider.

    Declaration
    public TScalar step { get; set; }
    Property Value
    Type Description
    TScalar
    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    swapThumbs

    Whether the thumbs can be swapped a thumb value becomes greater than the next one or when it becomes smaller than the previous one.

    Declaration
    public bool swapThumbs { get; set; }
    Property Value
    Type Description
    bool
    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    thumbComparer

    The comparer used to compare the thumb values of the slider.

    Declaration
    public IComparer<TScalar> thumbComparer { get; set; }
    Property Value
    Type Description
    IComparer<TScalar>
    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    thumbCount

    Get the number of thumbs for this slider.

    Declaration
    protected abstract int thumbCount { get; }
    Property Value
    Type Description
    int
    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    validateValue

    The validation function used to validate the value of the slider.

    Declaration
    public Func<TValue, bool> validateValue { get; set; }
    Property Value
    Type Description
    Func<TValue, bool>
    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    value

    The current value of the slider.

    Declaration
    public TValue value { get; set; }
    Property Value
    Type Description
    TValue
    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    Methods

    Clamp(TValue, TScalar, TScalar)

    Utility method to clamp a TValue value between specified bounds.

    Declaration
    protected virtual TValue Clamp(TValue v, TScalar lowBound, TScalar highBound)
    Parameters
    Type Name Description
    TValue v

    The value to clamp.

    TScalar lowBound

    Minimum

    TScalar highBound

    Maximum

    Returns
    Type Description
    TValue

    The clamped value.

    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    ClampThumb(TScalar, TScalar, TScalar)

    Clamp the thumb value.

    Declaration
    protected abstract TScalar ClampThumb(TScalar x, TScalar min, TScalar max)
    Parameters
    Type Name Description
    TScalar x

    The value to clamp.

    TScalar min

    The minimum value.

    TScalar max

    The maximum value.

    Returns
    Type Description
    TScalar

    The clamped values.

    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    ComputeValueFromDrag(Draggable)

    Returns the value to set as slider value based on a given dragger position.

    Declaration
    protected virtual TValue ComputeValueFromDrag(Draggable dragger)
    Parameters
    Type Name Description
    Draggable dragger

    The dragger manipulator.

    Returns
    Type Description
    TValue

    The value to set as slider value based on a given dragger position.

    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    FindClosestThumbValue(Draggable, ReadOnlySpan<TScalar>, out int)

    Find the closest thumb value to the given dragger position.

    Declaration
    protected TScalar FindClosestThumbValue(Draggable dragger, ReadOnlySpan<TScalar> values, out int index)
    Parameters
    Type Name Description
    Draggable dragger

    The dragger manipulator.

    ReadOnlySpan<TScalar> values

    The values of the thumbs.

    int index

    The index of the closest thumb value.

    Returns
    Type Description
    TScalar

    The closest thumb value to the given dragger position.

    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    FindClosestThumbValue(TScalar, int, Func<int, TScalar>, out int)

    Find the closest thumb value to the given value.

    Declaration
    protected TScalar FindClosestThumbValue(TScalar v, int count, Func<int, TScalar> predicate, out int index)
    Parameters
    Type Name Description
    TScalar v

    The value to find the closest thumb value to.

    int count

    The number of thumbs.

    Func<int, TScalar> predicate

    The predicate to get the thumb value at a specific index.

    int index

    The index of the closest thumb value.

    Returns
    Type Description
    TScalar

    The closest thumb value to the given value.

    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    FindClosestThumbValue(TScalar, ReadOnlySpan<TScalar>, out int)

    Find the closest thumb value to the given value.

    Declaration
    protected TScalar FindClosestThumbValue(TScalar v, ReadOnlySpan<TScalar> values, out int index)
    Parameters
    Type Name Description
    TScalar v

    The value to find the closest thumb value to.

    ReadOnlySpan<TScalar> values

    The values of the thumbs.

    int index

    The index of the closest thumb value.

    Returns
    Type Description
    TScalar

    The closest thumb value to the given value.

    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    GetClampedValue(TValue)

    Return the clamped value using current lowValue and highValue values.

    Declaration
    protected virtual TValue GetClampedValue(TValue newValue)
    Parameters
    Type Name Description
    TValue newValue

    The value to clamp.

    Returns
    Type Description
    TValue

    The clamped value.

    Remarks

    The method also checks if low and high values are inverted.

    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    GetNormalizedValueFromDrag(Draggable)

    Get a normalized value from a dragger position.

    Declaration
    protected float GetNormalizedValueFromDrag(Draggable dragger)
    Parameters
    Type Name Description
    Draggable dragger

    The dragger manipulator.

    Returns
    Type Description
    float

    The normalized value from a dragger position.

    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    GetScalarValuesFromValue(TValue, Span<TScalar>)

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

    Declaration
    protected abstract void GetScalarValuesFromValue(TValue value, Span<TScalar> values)
    Parameters
    Type Name Description
    TValue value

    The TValue value.

    Span<TScalar> values

    The list of thumb values.

    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    GetStepCount(TScalar)

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

    Declaration
    protected abstract int GetStepCount(TScalar stepValue)
    Parameters
    Type Name Description
    TScalar stepValue

    The step value.

    Returns
    Type Description
    int

    The number of possible steps.

    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    GetTrackElement()

    Get the element that represent the entire track of the slider.

    Declaration
    protected virtual VisualElement GetTrackElement()
    Returns
    Type Description
    VisualElement

    The element that represent the entire track of the slider.

    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    GetValueFromScalarValues(Span<TScalar>)

    Get the TValue value from the list of thumb values.

    Declaration
    protected abstract TValue GetValueFromScalarValues(Span<TScalar> values)
    Parameters
    Type Name Description
    Span<TScalar> values

    The list of thumb values.

    Returns
    Type Description
    TValue

    The TValue value.

    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    InvokeValueChangedCallbacks()

    Called when the value of the slider has changed via the value property.

    Declaration
    protected virtual void InvokeValueChangedCallbacks()
    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    KeyDecrement(TScalar, TScalar, KeyDownEvent)

    Decrement the value of the slider on a specific thumb.

    Declaration
    protected virtual TScalar KeyDecrement(TScalar baseValue, TScalar stepValue, KeyDownEvent evt)
    Parameters
    Type Name Description
    TScalar baseValue

    The base value to decrement.

    TScalar stepValue

    The decrement step value.

    KeyDownEvent evt

    The key down event.

    Returns
    Type Description
    TScalar

    The decremented value.

    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    KeyIncrement(TScalar, TScalar, KeyDownEvent)

    Increment the value of the slider on a specific thumb.

    Declaration
    protected virtual TScalar KeyIncrement(TScalar baseValue, TScalar stepValue, KeyDownEvent evt)
    Parameters
    Type Name Description
    TScalar baseValue

    The base value to increment.

    TScalar stepValue

    The increment step value.

    KeyDownEvent evt

    The key down event.

    Returns
    Type Description
    TScalar

    The incremented value.

    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    Mad(int, TScalar, TScalar)

    Performs an arithmetic multiply/add operation.

    Declaration
    protected abstract TScalar Mad(int m, TScalar a, TScalar b)
    Parameters
    Type Name Description
    int m

    The number of times to multiply the a value.

    TScalar a

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

    TScalar b

    The addition value.

    Returns
    Type Description
    TScalar

    The incremented value.

    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    OnDirectionChanged(ContextChangedEvent<DirContext>)

    Event callback called when the direction of the layout has changed.

    Declaration
    protected virtual void OnDirectionChanged(ContextChangedEvent<DirContext> evt)
    Parameters
    Type Name Description
    ContextChangedEvent<DirContext> evt

    The direction context changed event

    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    OnGeometryChanged(GeometryChangedEvent)

    Event callback called when the geometry of the slider has changed in the layout.

    Declaration
    protected virtual void OnGeometryChanged(GeometryChangedEvent evt)
    Parameters
    Type Name Description
    GeometryChangedEvent evt

    The geometry changed event.

    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    OnKeyDown(KeyDownEvent)

    Base implementation of KeyDown event handler.

    Declaration
    protected virtual void OnKeyDown(KeyDownEvent evt)
    Parameters
    Type Name Description
    KeyDownEvent evt

    The key down event.

    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    OnSliderRangeChanged()

    Called when the low or high value of Slider has changed.

    Declaration
    protected virtual void OnSliderRangeChanged()
    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    OnStyleResolved(CustomStyleResolvedEvent)

    Event callback called when the style of the slider has been resolved.

    Declaration
    protected virtual void OnStyleResolved(CustomStyleResolvedEvent evt)
    Parameters
    Type Name Description
    CustomStyleResolvedEvent evt

    The custom style resolved event.

    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    OnTrackClicked()

    Called when the track has received a click event.

    Declaration
    protected virtual void OnTrackClicked()
    Remarks

    Always check if the mouse has moved using hasMoved.

    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    OnTrackDown(Draggable)

    Event callback called when a pointer down event is received.

    Declaration
    protected virtual void OnTrackDown(Draggable dragger)
    Parameters
    Type Name Description
    Draggable dragger

    The dragger manipulator.

    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    OnTrackDragged(Draggable)

    Event callback called when the dragger is dragged.

    Declaration
    protected virtual void OnTrackDragged(Draggable dragger)
    Parameters
    Type Name Description
    Draggable dragger

    The dragger manipulator.

    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    OnTrackUp(Draggable)

    Event callback called when a pointer up event is received.

    Declaration
    protected virtual void OnTrackUp(Draggable dragger)
    Parameters
    Type Name Description
    Draggable dragger

    The dragger manipulator.

    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    ParseRawValueToString(TValue)

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

    Declaration
    protected virtual string ParseRawValueToString(TValue val)
    Parameters
    Type Name Description
    TValue val

    The TValue value to convert.

    Returns
    Type Description
    string

    The converted value.

    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.

    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    ParseStringToValue(string, out TValue)

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

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

    Declaration
    protected abstract bool ParseStringToValue(string strValue, out TValue value)
    Parameters
    Type Name Description
    string strValue

    The string value to convert.

    TValue value

    The stringThe converted value.

    Returns
    Type Description
    bool

    True if can be parsed, False otherwise.

    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    ParseSubValueToString(TScalar)

    Method to implement to resolve a TValue 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 virtual string ParseSubValueToString(TScalar val)
    Parameters
    Type Name Description
    TScalar val

    The TValue value to convert.

    Returns
    Type Description
    string

    The converted value.

    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    ParseValueToString(TValue)

    Method to implement to resolve a TValue 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 virtual string ParseValueToString(TValue val)
    Parameters
    Type Name Description
    TValue val

    The TValue value to convert.

    Returns
    Type Description
    string

    The converted value.

    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    SetOrientation(Direction)

    Called when the orientation of the slider has changed.

    Declaration
    protected virtual void SetOrientation(Direction newValue)
    Parameters
    Type Name Description
    Direction newValue

    The new orientation value.

    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    SetShiftStep(TScalar)

    Set the shift step value of the slider.

    Declaration
    protected virtual void SetShiftStep(TScalar newShiftStep)
    Parameters
    Type Name Description
    TScalar newShiftStep

    The new shift step value.

    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    SetStep(TScalar)

    Set the step value of the slider.

    Declaration
    protected virtual void SetStep(TScalar newStep)
    Parameters
    Type Name Description
    TScalar newStep

    The new step value.

    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    SetSwapThumbs(bool)

    Set the swap thumbs value of the slider.

    Declaration
    protected virtual void SetSwapThumbs(bool newSwapThumbs)
    Parameters
    Type Name Description
    bool newSwapThumbs

    The new swap thumbs value.

    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    SetValueWithoutNotify(TValue)

    Set the value of the slider without sending any event.

    Declaration
    public abstract void SetValueWithoutNotify(TValue newValue)
    Parameters
    Type Name Description
    TValue newValue

    The new value of the slider.

    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    SliderLerpUnclamped(TScalar, TScalar, 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 abstract TScalar SliderLerpUnclamped(TScalar a, TScalar b, float interpolant)
    Parameters
    Type Name Description
    TScalar a

    The lowest value in the range.

    TScalar b

    The highest value in the range.

    float interpolant

    The normalized value to process.

    Returns
    Type Description
    TScalar

    The interpolated value.

    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    SliderNormalizeValue(TScalar, TScalar, TScalar)

    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 abstract float SliderNormalizeValue(TScalar currentValue, TScalar lowerValue, TScalar higherValue)
    Parameters
    Type Name Description
    TScalar currentValue

    The value to normalize.

    TScalar lowerValue

    The lowest value in the range.

    TScalar higherValue

    The highest value in the range.

    Returns
    Type Description
    float

    The normalized value.

    See Also
    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt

    Implements

    IEventHandler
    ITransform
    ITransitionAnimations
    IExperimentalFeatures
    IVisualElementScheduler
    IResolvedStyle
    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.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>>)

    See Also

    Slider<TValue, TScalar, TInputField>
    SliderFloat
    SliderInt
    RangeSliderFloat
    RangeSliderInt
    TouchSlider<TValue>
    TouchSliderFloat
    TouchSliderInt
    In This Article
    Back to top
    Copyright © 2025 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)