Game.UI.Widgets.Float2InputField
Assembly:
Assembly-CSharp
Namespace: Game.UI.Widgets
Type:
class
Base:
FloatField
Summary:
A UI input field specialized for two-component single-precision vectors (Unity.Mathematics.float2). It adapts the generic FloatField
Fields
- This class does not declare any new instance fields.
All storage/fields (if any) are inherited from the FloatFieldbase class.
Properties
-
protected override Unity.Mathematics.float2 defaultMin { get; }
Returns a float2 initialized to float.MinValue for both components. This is used as the default minimum bound for the input field. -
protected override Unity.Mathematics.float2 defaultMax { get; }
Returns a float2 initialized to float.MaxValue for both components. This is used as the default maximum bound for the input field.
Constructors
public Float2InputField()
No explicit constructor is declared in the source; the class uses the compiler-generated default constructor and relies on base class initialization.
Methods
public override Unity.Mathematics.float2 ToFieldType(Unity.Mathematics.double4 value)
Converts the given double4 (the field's internal numeric representation) to a float2 by taking the x and y components and casting them to float (constructed as new float2(value.xy)). Only the xy components are used; z and w are ignored.
Usage Example
using Unity.Mathematics;
using Game.UI.Widgets;
// Example: converting a double4 read from the field to float2
var field = new Float2InputField();
// Suppose the underlying field system returns a double4 (x, y, z, w)
double4 rawValue = new double4(1.25, -3.5, 0.0, 0.0);
// Convert to float2 for game logic
float2 vec = field.ToFieldType(rawValue); // vec == new float2(1.25f, -3.5f)
Additional notes for modders: - float2 is from the Unity.Mathematics package; ensure your mod references Unity.Mathematics if interacting with this type. - Because the conversion discards z/w and casts doubleāfloat, be mindful of any precision or component-loss implications when using this field for values that require higher precision or additional components.