Game.UI.Widgets.Float4InputField
Assembly: Assembly-CSharp (typical for game/runtime mods)
Namespace: Game.UI.Widgets
Type: class
Base: FloatField
Summary:
Float4InputField is a specialized UI input field for editing a 4-component float vector (Unity.Mathematics.float4). It derives from the generic FloatField
Fields
This class declares no additional fields of its own; it relies on members provided by its base class FloatField
Properties
-
protected override float4 defaultMin => new float4(float.MinValue)
Defines the default minimum allowed value for each component of the float4 field. Each component is set to float.MinValue by default, so the field does not artificially clamp toward a small range. -
protected override float4 defaultMax => new float4(float.MaxValue)
Defines the default maximum allowed value for each component of the float4 field. Each component is set to float.MaxValue by default.
Constructors
public Float4InputField()
No explicit constructor is declared in the source; the class uses the default parameterless constructor inherited/auto-generated. Initialization behavior (visual setup, event hookup, etc.) is handled by the base FloatField implementation or elsewhere in the UI lifecycle.
Methods
public override float4 ToFieldType(double4 value)
Converts a double4 value (often used internally by the base field to represent user-entered numeric values) to a float4 by constructing a new float4 from the double4 input. This reduces the precision to float for the field's stored value.
Remarks: - Uses Unity.Mathematics float4/double4 types. - Conversion is a straightforward cast via the float4 constructor: new float4(value). - Because the class defines defaultMin/defaultMax using float.MinValue/float.MaxValue, component clamping (if any) will be based on float bounds.
Usage Example
using Unity.Mathematics;
using Game.UI.Widgets;
// Create a Float4InputField instance (typical usage within UI building code)
var vecField = new Float4InputField();
// If the base FloatField<T> exposes a Value property, set/get the value like:
vecField.Value = new float4(1f, 2f, 3f, 4f);
var current = vecField.Value;
// If the base class exposes events (names may vary), you can subscribe to value changes:
// vecField.OnValueChanged += newVal => Debug.Log($"New value: {newVal}");
// Add the field to your UI layout according to the UI framework used by the game.
Notes for modders:
- This control is intended for 4-component float input (e.g., colors, positions, directions, or custom vector data).
- The class depends on Unity.Mathematics types (float4/double4). Ensure your code imports Unity.Mathematics where needed.
- Behavior such as formatting, step increments, validation, visual layout, and event names comes from the FloatField