Skip to content

Game.UI.Debug.ValueField

Assembly: Assembly-CSharp.dll
Namespace: Game.UI.Debug

Type: class

Base: Game.UI.Widgets.ValueField

Summary:
A debug-specific ValueField implementation that wraps a DebugUI.Value. It periodically polls the underlying debug value (using the debug widget's refreshRate) and caches both the raw object value and its formatted string representation. The cached string is returned by GetValue() for display in the UI. Uses Unity's Time.deltaTime to drive the refresh timer and avoids reallocating the formatted string unless the underlying value changes.


Fields

  • private DebugUI.Value m_DebugWidget
    Holds the DebugUI.Value instance that provides the underlying value and formatting logic (GetValue() and FormatString()).

  • private object m_ObjectValue
    Cached last-seen raw value returned by m_DebugWidget.GetValue(). Used to detect changes and avoid unnecessary formatting.

  • private string m_StringValue
    Cached formatted string produced by m_DebugWidget.FormatString(m_ObjectValue). Returned by GetValue() for rendering.

  • private float m_Timer
    Counts down (subtracting Time.deltaTime each frame) until the next refresh. When <= 0, the value is re-read and possibly reformatted, and the timer is reset to m_DebugWidget.refreshRate.

Properties

  • public override string propertiesTypeName { get; }
    Returns the full type name of the base widget type: typeof(Game.UI.Widgets.ValueField).FullName. Used by the UI system to identify or serialize property metadata consistent with the base widget.

Constructors

  • public ValueField(DebugUI.Value debugWidget)
    Constructs a ValueField bound to the provided DebugUI.Value. The debugWidget is stored in m_DebugWidget and will be polled on its refresh schedule.

Methods

  • protected override WidgetChanges Update()
    Decrements m_Timer by Time.deltaTime. If the timer reaches zero or below, it resets m_Timer to m_DebugWidget.refreshRate, retrieves the current value from m_DebugWidget.GetValue(), and if that value differs from m_ObjectValue, updates m_ObjectValue and recalculates m_StringValue via m_DebugWidget.FormatString(m_ObjectValue). Finally, it returns base.Update() so that the parent widget logic can run as well.

  • public override string GetValue()
    Returns the cached formatted string m_StringValue. If the cached string is null, returns an empty string instead. This method is intended for the UI rendering system to obtain the display text.

Usage Example

// Suppose 'debugValue' is a DebugUI.Value provided by some debug system:
DebugUI.Value debugValue = /* obtain debug value */;

// Create the debug ValueField and add it to your UI hierarchy:
var valueField = new Game.UI.Debug.ValueField(debugValue);
// Add to parent widget / layout as appropriate for the UI system.
// The field will automatically poll debugValue at debugValue.refreshRate
// and display the formatted string returned by debugValue.FormatString(...).