Class IntField
A text field component that accepts and validates integer number input.
Inheritance
Implements
Inherited Members
Namespace: Unity.AppUI.UI
Assembly: Unity.AppUI.dll
Syntax
[UxmlElement]
public class IntField : NumericalField<int>, IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, IContextOverrideElement, IAdditionalDataHolder, IInputElement<int>, IValidatableElement<int>, ISizeableElement, INotifyValueChanging<int>, INotifyValueChanged<int>, IFormattable<int>, IValueField<int>
Remarks
IntField is an input component that allows users to enter and modify integer values. It provides validation, formatting, and range constraints to ensure proper numeric input.
The field supports keyboard input, arrow key increments/decrements, and optional unit display. It can be customized with minimum and maximum value constraints.
When setting minimum (lowValue) and maximum (highValue) constraints, ensure that the minimum value is less than the maximum value to avoid unexpected behavior.
The component supports different sizes and can be integrated into forms or used standalone. It automatically validates input to ensure only valid integer values are accepted.
Constructors
IntField()
Default constructor.
Declaration
public IntField()
Methods
ApplyInputDeviceDelta(Vector3, DeltaSpeed, int)
Apply input device delta to the UnityEngine.UIElements.IValueField`1 element.
Declaration
public override void ApplyInputDeviceDelta(Vector3 delta, DeltaSpeed speed, int startValue)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | delta | The delta from the input device. |
| DeltaSpeed | speed | The speed of the delta application. |
| int | startValue | The starting value for the delta application. |
Overrides
AreEqual(int, int)
Check if two values of type TValue are equal.
Declaration
protected override bool AreEqual(int a, int b)
Parameters
| Type | Name | Description |
|---|---|---|
| int | a | The first value to test. |
| int | b | The second value to test. |
Returns
| Type | Description |
|---|---|
| bool | True if both values are considered equals, false otherwise. |
Overrides
GetIncrementFactor(int)
Calculate the increment factor based on a base value.
Declaration
protected override float GetIncrementFactor(int baseValue)
Parameters
| Type | Name | Description |
|---|---|---|
| int | baseValue | The base value. |
Returns
| Type | Description |
|---|---|
| float | The increment factor. |
Overrides
Increment(int, float)
Increment a given value with a given delta.
Declaration
protected override int Increment(int originalValue, float delta)
Parameters
| Type | Name | Description |
|---|---|---|
| int | originalValue | The original value. |
| float | delta | The delta used for increment. |
Returns
| Type | Description |
|---|---|
| int | The incremented value. |
Overrides
Max(int, int)
Return the biggest value between a and b.
Declaration
protected override int Max(int a, int b)
Parameters
| Type | Name | Description |
|---|---|---|
| int | a | The first value to test. |
| int | b | The second value to test. |
Returns
| Type | Description |
|---|---|
| int | The biggest value. |
Overrides
Min(int, int)
Return the smallest value between a and b.
Declaration
protected override int Min(int a, int b)
Parameters
| Type | Name | Description |
|---|---|---|
| int | a | The first value to test. |
| int | b | The second value to test. |
Returns
| Type | Description |
|---|---|
| int | The smallest value. |
Overrides
ParseRawValueToString(int)
Define the conversion from a TValue value to a string value.
Declaration
protected override string ParseRawValueToString(int val)
Parameters
| Type | Name | Description |
|---|---|---|
| int | val | The TValue value to convert. |
Returns
| Type | Description |
|---|---|
| string | The converted value. |
Overrides
Remarks
This method is used to convert the value to a string without any formatting.
ParseStringToValue(string, out int)
Define the conversion from the string value to a TValue value.
Declaration
protected override bool ParseStringToValue(string strValue, out int val)
Parameters
| Type | Name | Description |
|---|---|---|
| string | strValue | The string value to convert. |
| int | val | The TValue value returned. |
Returns
| Type | Description |
|---|---|
| bool | True if the conversion is possible, False otherwise. |
Overrides
ParseValueToString(int)
Define the conversion from a TValue value to a string value.
Declaration
protected override string ParseValueToString(int val)
Parameters
| Type | Name | Description |
|---|---|---|
| int | val | The TValue value to convert. |
Returns
| Type | Description |
|---|---|
| string | The converted value. |