unity
runtime_error
ai_generated
true
InvalidOperationException: Cannot read value for action 'Jump' because the action map 'Gameplay' is not enabled
ID: unity/input-system-action-map-not-enabled
95%Fix Rate
88%Confidence
1Evidence
2023-08-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| Unity 2022.3 | active | — | — | — |
| Unity 2023.2 | active | — | — | — |
| Input System 1.5.0 | active | — | — | — |
| Input System 1.6.0 | active | — | — | — |
Root Cause
The Input Action Map containing the action is not enabled before trying to read its value, typically because Enable() was not called on the map or the InputActionAsset.
generic中文
包含该动作的输入动作映射在尝试读取其值之前未启用,通常是因为未对映射或InputActionAsset调用Enable()。
Official Documentation
https://docs.unity3d.com/Packages/[email protected]/manual/ActionMaps.htmlWorkarounds
-
95% success In Awake() or Start(), enable the action map before any input read: inputActionAsset.FindActionMap("Gameplay").Enable(); or use inputActionAsset.Enable() to enable all maps.
In Awake() or Start(), enable the action map before any input read: inputActionAsset.FindActionMap("Gameplay").Enable(); or use inputActionAsset.Enable() to enable all maps. -
90% success If using PlayerInput component, set the Default Map in the inspector to the desired map, and ensure the component is enabled on the GameObject.
If using PlayerInput component, set the Default Map in the inspector to the desired map, and ensure the component is enabled on the GameObject.
-
85% success Use InputAction.Enable() on each action after setting up callbacks, but ensure the parent map is also enabled to avoid conflicts.
Use InputAction.Enable() on each action after setting up callbacks, but ensure the parent map is also enabled to avoid conflicts.
中文步骤
在Awake()或Start()中启用动作映射,然后再读取任何输入:inputActionAsset.FindActionMap("Gameplay").Enable(); 或使用inputActionAsset.Enable()启用所有映射。如果使用PlayerInput组件,在检查器中设置默认映射为所需映射,并确保组件在游戏对象上已启用。
在每个动作上设置回调后使用InputAction.Enable(),但确保父映射也已启用以避免冲突。
Dead Ends
Common approaches that don't work:
-
90% fail
Overrides bypass the normal input flow and can cause stale values or conflicts with actual input devices. The action map still remains disabled.
-
85% fail
This defeats the purpose of using action maps for contextual input (e.g., UI vs Gameplay) and may break input switching logic.
-
80% fail
Enabling individual actions without the parent map can lead to inconsistent state and may not register input correctly if the map is disabled.