unity config_error ai_generated true

InvalidOperationException: InputActionMap 'Gameplay' not found in InputActionAsset 'Controls'.

ID: unity/input-system-action-map-not-found

Also available as: JSON · Markdown · 中文
95%Fix Rate
89%Confidence
1Evidence
2024-03-22First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
1.4 active
1.5 active
1.6 active
1.7 active

Root Cause

Code references an InputActionMap name that does not exist in the assigned InputActionAsset asset.

generic

中文

代码引用了一个在分配的输入操作资源中不存在的输入操作映射名称。

Official Documentation

https://docs.unity3d.com/Packages/[email protected]/manual/ActionAssets.html

Workarounds

  1. 98% success Open the InputActionAsset (e.g., 'Controls.inputactions') in the editor, verify the map name is 'Gameplay', and correct the code: InputActionMap gameplayMap = inputAsset.FindActionMap("Gameplay"); If the map is named differently, update the string.
    Open the InputActionAsset (e.g., 'Controls.inputactions') in the editor, verify the map name is 'Gameplay', and correct the code: InputActionMap gameplayMap = inputAsset.FindActionMap("Gameplay"); If the map is named differently, update the string.
  2. 70% success Use FindActionMap with a fallback: var map = inputAsset.FindActionMap("Gameplay") ?? inputAsset.FindActionMap("Default"); This prevents crashes but may not bind the correct actions.
    Use FindActionMap with a fallback: var map = inputAsset.FindActionMap("Gameplay") ?? inputAsset.FindActionMap("Default"); This prevents crashes but may not bind the correct actions.
  3. 85% success Regenerate the InputActionAsset from a template that includes the missing map: right-click > Create > Input Actions, then copy the map structure from the old asset.
    Regenerate the InputActionAsset from a template that includes the missing map: right-click > Create > Input Actions, then copy the map structure from the old asset.

中文步骤

  1. Open the InputActionAsset (e.g., 'Controls.inputactions') in the editor, verify the map name is 'Gameplay', and correct the code: InputActionMap gameplayMap = inputAsset.FindActionMap("Gameplay"); If the map is named differently, update the string.
  2. Use FindActionMap with a fallback: var map = inputAsset.FindActionMap("Gameplay") ?? inputAsset.FindActionMap("Default"); This prevents crashes but may not bind the correct actions.
  3. Regenerate the InputActionAsset from a template that includes the missing map: right-click > Create > Input Actions, then copy the map structure from the old asset.

Dead Ends

Common approaches that don't work:

  1. 90% fail

    Random names never match the asset; the name must exactly match the one in the .inputactions file.

  2. 40% fail

    This loses all existing bindings and requires reconfiguring controls, which is overkill for a missing map name.

  3. 70% fail

    ListEnabledActions returns actions, not maps; it does not help locate the correct map name.