# 无效操作异常：无法启用操作映射'Gameplay'，因为它已经启用

- **ID:** `unity/input-system-action-map-conflict`
- **领域:** unity
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 93%

## 根因

在未先禁用的情況下对已启用的InputActionMap调用Enable()，导致状态冲突。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 1.5.0 | active | — | — |
| 1.6.0 | active | — | — |
| 1.4.4 | active | — | — |

## 解决方案

1. ```
   Check if action map is already enabled before enabling: if (!inputActionAsset.FindActionMap("Gameplay").enabled) { inputActionAsset.FindActionMap("Gameplay").Enable(); }
   ```
2. ```
   Use a flag to track state: private bool gameplayEnabled; void EnableGameplay() { if (!gameplayEnabled) { inputActionAsset.FindActionMap("Gameplay").Enable(); gameplayEnabled = true; } }
   ```

## 无效尝试

- **Calling Enable() multiple times in Update() without check** — Repeats the same error; no guard against double-enable. (90% 失败率)
- **Disabling and re-enabling in same frame** — If not properly sequenced, still throws error; better to check enabled state. (50% 失败率)
