Game.Float2SliderField
Assembly:
Namespace: Game.UI.Widgets
Type: class
Base: FloatSliderField
Summary:
A concrete UI slider field for editing 2D float vectors (Unity.Mathematics.float2). This class specifies the per-component minimum and maximum values (using the full float range) and converts a double4 value to the float2 field type by taking the X and Y components. Intended for use in the game's UI widget system where 2D float values are required.
Fields
- This class declares no private or public fields.
This type relies on members inherited from FloatSliderField.
Properties
-
protected override float2 defaultMin { get; }
Overrides the base default minimum for the slider field. Returns a float2 where both components are set to float.MinValue (i.e., the minimum representable float). -
protected override float2 defaultMax { get; }
Overrides the base default maximum for the slider field. Returns a float2 where both components are set to float.MaxValue (i.e., the maximum representable float).
Constructors
public Float2SliderField()
No explicit constructor is defined in source; the default parameterless constructor is used. Initialization logic (if any) should be handled by the base class.
Methods
public override float2 ToFieldType(double4 value)
Converts a double4 to the field's float2 type by taking the XY components and constructing a float2 from them. This will perform a conversion from double precision to single precision, so be aware of potential precision loss. Effectively:- input: double4 value
- result: new float2(value.xy)
Usage Example
// Create and use the Float2SliderField (example usage; actual instantiation may
// be different depending on the UI framework integration)
var field = new Float2SliderField();
double4 incoming = new double4(1.5, -2.25, 0.0, 0.0);
float2 result = field.ToFieldType(incoming); // result == new float2(1.5f, -2.25f)
Additional notes: - The defaultMin/defaultMax use the full float range; for practical UI use you will likely want to clamp or provide a narrower sensible range. - This class depends on Unity.Mathematics (float2, double4). Ensure the appropriate using/imports and assemblies are present when compiling or referencing this type.