Skip to content

Game.UI.Widgets.Float3SliderField

Assembly: Assembly-CSharp
Namespace: Game.UI.Widgets

Type: class

Base: FloatSliderField

Summary:
A UI slider field specialized for 3-component floating-point vectors (Unity.Mathematics.float3). It provides default min/max values for each component and a conversion method from a double4 (the internal numeric representation often used by the underlying slider system) into the field type (float3). This widget is intended for use in the game's UI to edit Vector3-like values (position, rotation, scale components, etc.) in modding code.


Fields

  • This class declares no private or public fields in this file.
    There are no explicit instance fields defined here; it relies on members inherited from FloatSliderField.

Properties

  • protected override float3 defaultMin { get; }
    Returns a float3 where each component is set to float.MinValue. This defines the fallback minimum bounds for the slider when no other min is provided.

  • protected override float3 defaultMax { get; }
    Returns a float3 where each component is set to float.MaxValue. This defines the fallback maximum bounds for the slider when no other max is provided.

Constructors

  • public Float3SliderField()
    No explicit constructors are defined; the class uses the default parameterless constructor provided by the compiler.

Methods

  • public override float3 ToFieldType(double4 value)
    Converts a double4 (commonly used internally by the underlying slider/field system) to a Unity.Mathematics.float3 by copying the x, y, z components (value.xyz). The w component of the double4 is ignored.

Remarks: - The conversion uses new float3(value.xyz), so precision is reduced from double to float. - Using float.MinValue/float.MaxValue as default bounds can be problematic for practical UI clamping or numeric display; consider supplying explicit sensible min/max bounds when constructing/configuring the slider.

Usage Example

using Unity.Mathematics;
using Game.UI.Widgets;

// Example: converting a double4 (from slider internals) into the field type
double4 internalValue = new double4(1.5, -2.25, 0.0, 0.0);
Float3SliderField slider = /* obtain or create the slider instance from UI setup */ null;

// Direct conversion demonstration (normally called by the slider framework)
float3 fieldValue = slider.ToFieldType(internalValue);
// fieldValue == new float3(1.5f, -2.25f, 0.0f)

Additional notes: - This widget depends on the FloatSliderField generic base class — behavior such as rendering, user interaction, clamping, and event callbacks is implemented there. - If your use case requires clamped ranges, provide explicit min/max values appropriate for the parameter being edited rather than relying on the extreme defaults.