Game.Float4SliderField
Assembly:
Assembly-CSharp
Namespace: Game.UI.Widgets
Type: Class
Base: FloatSliderField
Summary:
A UI slider field specialized for 4-component floating-point values (Unity.Mathematics.float4). This class provides the component-wise default minimum and maximum ranges (using float.MinValue and float.MaxValue) and implements conversion from double4 to float4 for the underlying field value. It's intended to be used wherever the UI framework expects a FloatSliderField
Fields
- This class does not declare any additional instance fields beyond those inherited from its base types.
It relies on the base FloatSliderFieldimplementation for storage and UI behavior.
Properties
-
protected override float4 defaultMin { get; }
Returns a float4 where each component is set to float.MinValue. Used by the base slider implementation as the component-wise minimum allowed value when no other range is specified. -
protected override float4 defaultMax { get; }
Returns a float4 where each component is set to float.MaxValue. Used by the base slider implementation as the component-wise maximum allowed value when no other range is specified.
Constructors
public Float4SliderField()
Default constructor (compiler-provided). The class does not define any constructor logic; initialization and UI setup are handled by the base FloatSliderFieldand the UI framework.
Methods
public override float4 ToFieldType(double4 value)
Converts a double4 value to a float4 by casting each component to float. This conversion may lose precision when the input double components cannot be represented exactly as floats. This method is used by the field system to translate between the numeric representation used by some parts of the UI/data layer (double4) and this widget's field type (float4).
Usage Example
// Create the slider field (typically created/managed by the UI framework)
var slider = new Game.UI.Widgets.Float4SliderField();
// Convert a double4 to the field type (float4)
var input = new Unity.Mathematics.double4(1.5, 2.5, 3.5, 4.5);
Unity.Mathematics.float4 fieldValue = slider.ToFieldType(input);
// fieldValue is now a float4 containing (1.5f, 2.5f, 3.5f, 4.5f)
// The slider uses defaultMin/defaultMax for range if no other range is provided.