I ran into a problem when working with the action map in my Unity game. I wanted to break the controls into their own separate schemes for rebinding, but there was a problem! When I added the control schemes, my code seemed to stop working. I checked the C# callback and Default Map on my PlayerInput component, toggling autoswitch didn't do anything, and I double-checked to make sure there were no other scripts consuming the input events.
After inspecting the InputAsset as JSON, I noticed something! The devices (although in the editor it says "All Devices") were empty!
"controlSchemes": [
{
"name": "Gamepad",
"bindingGroup": "Gamepad",
"devices": []
},
{
"name": "Keyboard",
"bindingGroup": "Keyboard",
"devices": []
},
{
"name": "GCC",
"bindingGroup": "GCC",
"devices": []
}
]
Aha! I remembered a little tick box I didn't know the use of when creating the control schemes!
Here's what it looked like after I assigned them:
"controlSchemes": [
{
"name": "Gamepad",
"bindingGroup": "Gamepad",
"devices": [
{
"devicePath": "",
"isOptional": false,
"isOR": false
}
]
},
{
"name": "Keyboard",
"bindingGroup": "Keyboard",
"devices": [
{
"devicePath": "",
"isOptional": false,
"isOR": false
}
]
},
{
"name": "GCC",
"bindingGroup": "GCC",
"devices": [
{
"devicePath": "",
"isOptional": false,
"isOR": false
}
]
}
]
So remember to assign the device (although you already assigned the buttons in the action map) to the scheme!