Game.Debug.IntInputField
Assembly: Assembly-CSharp (game)
Namespace: Game.Debug
Type: class
Base: DebugUI.TextField
Summary:
A specialized debug UI text field that accepts only integer input. When validating a new value, the field allows empty strings (to permit clearing) and any string that can be parsed as an integer; otherwise it falls back to the base field value (via base.getter()).
Fields
- This class declares no private or public fields. {{ The class contains no explicit field members. Any state is inherited from DebugUI.TextField. }}
Properties
- This class declares no new properties. {{ All properties are inherited from DebugUI.TextField (for example, the current text/getter/setter behavior). }}
Constructors
- This class does not define an explicit constructor. {{ The default parameterless constructor from the CLR is used; initialization is handled by the base DebugUI.TextField constructor. }}
Methods
public override string ValidateValue(string value)
{{ Validates the provided string so that only integer values (or empty strings) are accepted. Behavior:- If value is null or empty, it is accepted and returned (allows clearing the field).
- If value can be parsed to an integer (int.TryParse succeeds), the value is accepted and returned.
- If value is not a valid integer, the method returns base.getter(), i.e. it falls back to the current/previous value provided by the base TextField implementation. Notes:
- The call to base.getter() assumes the base class exposes a getter method that returns the current field text. This is the fallback to keep the field unchanged on invalid input.
- The file includes "using UnityEngine.Rendering;" which appears unused and can be removed. }}
Usage Example
// Simple usage example: instantiate and validate values:
var intField = new Game.Debug.IntInputField();
string ok = intField.ValidateValue("123"); // returns "123"
string empty = intField.ValidateValue(""); // returns ""
string invalid = intField.ValidateValue("abc"); // returns base.getter() (the current/previous field value)
{{ YOUR_INFO }}