Skip to content

Game.Input.ActionType

Assembly: Assembly-CSharp
Namespace: Game.Input

Type: enum

Base: System.Enum

Summary:
An enumeration that defines the shape/type of an input action used by the game's input system. Use this to declare whether an input binding is a digital button, a single-axis (float) control, or a two-dimensional vector (e.g., joystick or mouse delta). This is used by the input mapping and handling code to know how to read, interpret and present input values to gameplay or UI systems. For modding Cities: Skylines 2, pick the appropriate ActionType when registering custom actions or parsing input configurations so the runtime and any editor/inspector tools handle the value correctly.


Fields

  • Button
    A digital on/off input (bool). Typical for keys, mouse buttons, or gamepad face buttons. Use when you only care about pressed/released/held states.

  • Axis
    A single floating-point axis (float). Typical for triggers, throttle, or any analog control that returns a scalar value in a range (commonly -1..1 or 0..1).

  • Vector2
    A two-component axis (UnityEngine.Vector2). Typical for joysticks, two-axis thumbsticks, or combined horizontal/vertical inputs (e.g., camera pan or movement on a 2D plane).

Properties

  • N/A
    This enum does not define properties. It is a simple value type used to distinguish input kinds.

Constructors

  • N/A
    Enums are value types with implicit constructors; there are no custom constructors to call.

Methods

  • N/A
    No methods are defined on this enum. Use it in switch statements or comparisons where needed.

Usage Example

// Example: simple input dispatcher that reads Unity's Input API based on ActionType.
// (Adapt to the game's input abstraction when integrating into Cities: Skylines 2 mods.)

public enum ActionType
{
    Button,
    Axis,
    Vector2
}

public class InputActionDefinition
{
    public string name;
    public ActionType type;
}

public static class InputActionReader
{
    public static object ReadAction(InputActionDefinition action)
    {
        switch (action.type)
        {
            case ActionType.Button:
                // returns a bool
                return UnityEngine.Input.GetButton(action.name);

            case ActionType.Axis:
                // returns a float
                return UnityEngine.Input.GetAxis(action.name);

            case ActionType.Vector2:
                // assumes axis names "name_X" and "name_Y" or similar mapping
                float x = UnityEngine.Input.GetAxis(action.name + "_X");
                float y = UnityEngine.Input.GetAxis(action.name + "_Y");
                return new UnityEngine.Vector2(x, y);

            default:
                throw new System.ArgumentOutOfRangeException();
        }
    }
}

// Usage:
// var def = new InputActionDefinition { name = "Move", type = ActionType.Vector2 };
// var value = InputActionReader.ReadAction(def);
// if (value is UnityEngine.Vector2 v) { /* handle 2D movement */ }

{{ YOUR_INFO }}
- When adding custom input actions for a Cities: Skylines 2 mod, ensure the ActionType matches how the input will be bound in the game's input settings and UI.
- Consider how values will be serialized (e.g., in mod settings files) and presented in keybinding menus; mismatching types (declaring Axis but providing a Vector2) will lead to incorrect behavior or UI problems.
- If integrating with Unity’s new Input System or the game's internal abstraction, convert between that system’s control types and this enum as needed for consistent behavior.