docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class FloatField

    A text field that accepts floating-point numeric values.

    Inheritance
    object
    CallbackEventHandler
    Focusable
    VisualElement
    BaseVisualElement
    ExVisualElement
    NumericalField<float>
    FloatField
    Implements
    IEventHandler
    IResolvedStyle
    ITransform
    ITransitionAnimations
    IExperimentalFeatures
    IVisualElementScheduler
    IContextOverrideElement
    IAdditionalDataHolder
    IInputElement<float>
    IValidatableElement<float>
    ISizeableElement
    INotifyValueChanging<float>
    INotifyValueChanged<float>
    IFormattable<float>
    IValueField<float>
    Inherited Members
    NumericalField<float>.ussClassName
    NumericalField<float>.inputContainerUssClassName
    NumericalField<float>.inputUssClassName
    NumericalField<float>.unitUssClassName
    NumericalField<float>.trailingContainerUssClassName
    NumericalField<float>.sizeUssClassName
    NumericalField<float>.m_InputContainer
    NumericalField<float>.m_InputElement
    NumericalField<float>.m_Size
    NumericalField<float>.m_TrailingContainer
    NumericalField<float>.m_UnitElement
    NumericalField<float>.m_Value
    NumericalField<float>.m_LastValue
    NumericalField<float>.m_UnitDragger
    NumericalField<float>.isDragging
    NumericalField<float>.acceptDragging
    NumericalField<float>.formatString
    NumericalField<float>.formatFunction
    NumericalField<float>.StartDragging()
    NumericalField<float>.StopDragging()
    NumericalField<float>.TrySendChangingEvent(float, float)
    NumericalField<float>.unit
    NumericalField<float>.lowValue
    NumericalField<float>.highValue
    NumericalField<float>.contentContainer
    NumericalField<float>.size
    NumericalField<float>.SetValueWithoutNotify(float)
    NumericalField<float>.value
    NumericalField<float>.invalid
    NumericalField<float>.validateValue
    NumericalField<float>.GetIncrementFactor(float, bool, bool)
    NumericalField<float>.GetSizeUssClassName(Size)
    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 FloatField : NumericalField<float>, IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, IContextOverrideElement, IAdditionalDataHolder, IInputElement<float>, IValidatableElement<float>, ISizeableElement, INotifyValueChanging<float>, INotifyValueChanged<float>, IFormattable<float>, IValueField<float>
    Remarks

    FloatField is an input control that allows users to enter and edit floating-point numbers. It provides validation, formatting, and range constraints for numeric input.

    The component supports both keyboard input and increment/decrement functionality. Users can directly type values or use up/down arrow keys to adjust the value incrementally.

    Note: The field can be customized with various formatting options and can display optional units alongside the numeric value.

    Examples

    Basic FloatField with validation.

    var field = new FloatField
    {
        value = 50.0f,
        lowValue = 0.0f,
        highValue = 100.0f,
        formatString = "F1",
        unit = "%"
    };
    

    // Add validation for even numbers field.validateValue = (value) => value % 2 == 0;

    FloatField with custom formatting and event handling.

    var field = new FloatField();
    

    // Custom format function to display with units field.formatFunction = (value) => $"{value:0.##} sec";

    // Listen for value changes field.RegisterValueChangedCallback(evt => { Debug.Log($"Value changed from to "); });

    UXML Definition Example.

    <ui:FloatField
        name="opacity-field"
        value="0.5"
        low-value="0"
        high-value="1"
        format-string="P0"
        unit="opacity"
        size="M" />

    Constructors

    FloatField()

    Default constructor.

    Declaration
    public FloatField()

    Methods

    ApplyInputDeviceDelta(Vector3, DeltaSpeed, float)

    Apply input device delta to the UnityEngine.UIElements.IValueField`1 element.

    Declaration
    public override void ApplyInputDeviceDelta(Vector3 delta, DeltaSpeed speed, float startValue)
    Parameters
    Type Name Description
    Vector3 delta

    The delta from the input device.

    DeltaSpeed speed

    The speed of the delta application.

    float startValue

    The starting value for the delta application.

    Overrides
    NumericalField<float>.ApplyInputDeviceDelta(Vector3, DeltaSpeed, float)

    AreEqual(float, float)

    Check if two values of type TValue are equal.

    Declaration
    protected override bool AreEqual(float a, float b)
    Parameters
    Type Name Description
    float a

    The first value to test.

    float b

    The second value to test.

    Returns
    Type Description
    bool

    True if both values are considered equals, false otherwise.

    Overrides
    NumericalField<float>.AreEqual(float, float)

    GetIncrementFactor(float)

    Calculate the increment factor based on a base value.

    Declaration
    protected override float GetIncrementFactor(float baseValue)
    Parameters
    Type Name Description
    float baseValue

    The base value.

    Returns
    Type Description
    float

    The increment factor.

    Overrides
    NumericalField<float>.GetIncrementFactor(float)

    Increment(float, float)

    Increment a given value with a given delta.

    Declaration
    protected override float Increment(float originalValue, float delta)
    Parameters
    Type Name Description
    float originalValue

    The original value.

    float delta

    The delta used for increment.

    Returns
    Type Description
    float

    The incremented value.

    Overrides
    NumericalField<float>.Increment(float, float)

    Max(float, float)

    Return the biggest value between a and b.

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

    The first value to test.

    float b

    The second value to test.

    Returns
    Type Description
    float

    The biggest value.

    Overrides
    NumericalField<float>.Max(float, float)

    Min(float, float)

    Return the smallest value between a and b.

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

    The first value to test.

    float b

    The second value to test.

    Returns
    Type Description
    float

    The smallest value.

    Overrides
    NumericalField<float>.Min(float, float)

    ParseRawValueToString(float)

    Define the conversion from a TValue value to a string value.

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

    The TValue value to convert.

    Returns
    Type Description
    string

    The converted value.

    Overrides
    NumericalField<float>.ParseRawValueToString(float)
    Remarks

    This method is used to convert the value to a string without any formatting.

    ParseStringToValue(string, out float)

    Define the conversion from the string value to a TValue value.

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

    The string value to convert.

    float val

    The TValue value returned.

    Returns
    Type Description
    bool

    True if the conversion is possible, False otherwise.

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

    ParseValueToString(float)

    Define the conversion from a TValue value to a string value.

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

    The TValue value to convert.

    Returns
    Type Description
    string

    The converted value.

    Overrides
    NumericalField<float>.ParseValueToString(float)

    Implements

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

    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)