Skip to content

Game.Input.Mode

Assembly: Assembly-CSharp
Namespace: Game.Input

Type: enum

Base: System.Enum

Summary: Represents the input interpretation mode for controls. Use this enum to indicate whether an input should be handled as a discrete digital value, a digital value exposed as a normalized float, or a continuous analog value. This lets input processing and mapping code handle different kinds of controllers or virtual input sources consistently.


Fields

  • DigitalNormalized This mode denotes a digital input (on/off) that is treated as a normalized floating value (commonly 0.0 or 1.0). Useful when code expects a float range but the source is binary.

  • Digital A discrete digital mode representing an on/off input (boolean-like). Use when only the binary pressed/released state matters.

  • Analog A continuous analog mode representing a variable input (e.g., joystick axis or trigger). Values are typically read as floats and can represent a range of values rather than just on/off.

Properties

  • This enum type has no properties.

Constructors

  • Enums in C# have an implicit constructor provided by the runtime; there are no explicit constructors defined for this enum.

Methods

  • This enum type defines no methods.

Usage Example

using Game.Input;

public float ReadInputValue(Mode mode, float rawValue)
{
    switch (mode)
    {
        case Mode.Digital:
            // Treat any non-zero as fully on (1.0f) or zero as off
            return rawValue != 0f ? 1f : 0f;
        case Mode.DigitalNormalized:
            // Ensure value is clamped to normalized 0..1 range (useful if upstream provides 0/1 as float)
            return Mathf.Clamp01(rawValue);
        case Mode.Analog:
            // Pass through analog value (assumed to already be in expected range)
            return rawValue;
        default:
            return 0f;
    }
}