{
  "id": "unity/input-system-float-parameter-invalid",
  "signature": "InvalidOperationException: Cannot read value of type 'float' from a control with value type 'Vector2'.",
  "signature_zh": "无效操作异常：无法从值类型为 'Vector2' 的控件读取类型为 'float' 的值。",
  "regex": "InvalidOperationException: Cannot read value of type '.*' from a control with value type '.*'\\.",
  "domain": "unity",
  "category": "type_error",
  "subcategory": null,
  "root_cause": "The Input System action is bound to a control that outputs a Vector2 (e.g., a joystick), but the code tries to read it as a single float, causing a type mismatch.",
  "root_cause_type": "generic",
  "root_cause_zh": "输入系统操作绑定到了输出 Vector2 的控件（例如摇杆），但代码试图将其作为单个 float 读取，导致类型不匹配。",
  "versions": [
    {
      "version": "Unity 2022.3.12f1",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Unity 2023.2.0b1",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Input System 1.7.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Changing the action type to 'Pass Through' without adjusting the control binding may still result in type mismatch if the control output type is incompatible.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Disabling and re-enabling the action map does not resolve the fundamental type mismatch between the expected value type and the control's output.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Change the action's expected value type to match the control. For a Vector2 control, read the value as `Vector2` using `action.ReadValue<Vector2>()`. For example: `Vector2 move = playerInput.actions[\"Move\"].ReadValue<Vector2>();`.",
      "success_rate": 0.95,
      "how": "Change the action's expected value type to match the control. For a Vector2 control, read the value as `Vector2` using `action.ReadValue<Vector2>()`. For example: `Vector2 move = playerInput.actions[\"Move\"].ReadValue<Vector2>();`.",
      "condition": "",
      "sources": []
    },
    {
      "action": "If only one axis is needed, bind the action to a single-axis control (e.g., Keyboard key or button) instead of a Vector2 stick, and read as `float`.",
      "success_rate": 0.85,
      "how": "If only one axis is needed, bind the action to a single-axis control (e.g., Keyboard key or button) instead of a Vector2 stick, and read as `float`.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use `action.ReadValue<float>()` only for actions bound to controls that output a single float, such as an Axis control. Verify the binding in the Input Action Asset editor.",
      "success_rate": 0.8,
      "how": "Use `action.ReadValue<float>()` only for actions bound to controls that output a single float, such as an Axis control. Verify the binding in the Input Action Asset editor.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "将操作的预期值类型更改为与控件匹配。对于 Vector2 控件，使用 `action.ReadValue<Vector2>()` 读取 Vector2 值。例如：`Vector2 move = playerInput.actions[\"Move\"].ReadValue<Vector2>();`。",
    "如果只需要一个轴，则将操作绑定到单轴控件（例如键盘按键或按钮），而不是 Vector2 摇杆，并作为 float 读取。",
    "仅当操作绑定到输出单个 float 的控件（例如 Axis 控件）时，才使用 `action.ReadValue<float>()`。在输入操作资源编辑器中验证绑定。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://docs.unity3d.com/Packages/com.unity.inputsystem@1.7/manual/ActionBindings.html",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.9,
  "resolvable": "true",
  "first_seen": "2023-08-12",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}