Game.UI.Widgets.FloatInputField
Assembly: Assembly-CSharp
Namespace: Game.UI.Widgets
Type: class
Base: FloatField
Summary:
FloatInputField is a concrete specialization of the generic FloatField
Fields
- (none declared in this class)
This class does not declare any private or public fields; it only overrides members from its base type.
Properties
-
protected override double defaultMin => double.MinValue
Specifies the default minimum allowed value for the field. This override sets the minimum to the smallest possible double value. The actual runtime minimum may be constrained further by the base class or by consumer code. -
protected override double defaultMax => double.MaxValue
Specifies the default maximum allowed value for the field. This override sets the maximum to the largest possible double value.
Constructors
public FloatInputField()
Implicit parameterless constructor. The class does not declare any explicit constructors, so the default constructor is used.
Methods
public override double ToFieldType(double4 value)
Converts the provided Unity.Mathematics.double4 to the field's value type (double). Implementation returns the X component (value.x). This is used when the UI or underlying systems provide a packed vector and the field must extract the scalar double value it represents.
Usage Example
// Example: creating and using a FloatInputField in a UI widget setup
using Unity.Mathematics;
using Game.UI.Widgets;
public class MyWidget
{
private FloatInputField myField;
public void Setup()
{
myField = new FloatInputField();
// The field's default range is double.MinValue..double.MaxValue.
// If FloatField<T> exposes setters for min/max, you can restrict it:
// myField.Min = -100.0;
// myField.Max = 100.0;
}
public void OnSomeEvent()
{
// Suppose the UI system supplies a double4 (e.g., from a packed representation)
double4 packedValue = new double4(42.5, 0, 0, 0);
// Convert to the field's scalar type using the overridden method
double scalar = myField.ToFieldType(packedValue); // returns 42.5
// Use the scalar value...
}
}
Notes: - FloatInputField extracts the X component from incoming double4 values; if you need to use a different component or a different interpretation, subclass FloatInputField and override ToFieldType accordingly. - Since defaultMin/defaultMax span the full double range, consider restricting them if you require clamped input in the UI.