Multiple Input Managers

I want to use one keyboard set for movement, and a different one for combat. I was wondering if it was possible to use Unity’s Input manager multiple times, for different sets of keys. I want to be able to hit the tilde (~) key while in game and switch between one set of controls and another. Can this be done with the Input manager? If not, could I weight the combat script to over-write the movement inputs when needed, then revert back to normal? (Would that be the easiest way, I suppose is the better question).

I’m still learning C# so I am not too sure how to work this out, but I couldn’t find anything in the documentation so I figured I would ask.

You will need to implement an own input mapping basing on KeyCode and GetKey instead of GetButton if you want to do more flexible mappings and switch between control sets

Wait, do you want to use 2 keyboards? Or did I read it wrong?

You were right in understanding my question, and I appreciate the speedy reply :stuck_out_tongue:

So am I correct in assuming that I can just set my movement to the Input Manager and have one axes set to ~ that switches on the Combat script, then write a script setting all the combat keys to static buttons, including one to the ~ to switch back to Input Manager? I’m assuming that would limit setting keys for the user to just the Movement since it uses the Input Manager, is that correct?

You could make your two scripts and then enable one while disabling the other with your ~ key, but as they said you need to have a manager type script.

Public walkscript myWalkScript;
Public combatscript myCombatScript;

If(input.getkeydown(keycode.//whatever code for ~ here//)
{
If(myWalkScript.enabled)
{
// disable walk script and enable combat
}
Else
{
// enable walk script disable combat
}
}

Sorry for getting lazy and the syntax error, but you get the idea… I’m sick of typing on this phone so hope this helps

1> check Edit > Prefrence
2> Goto
Windows>PackageManager
install
Visual Studio Editor
Now Open Scipt.

this problem is in 2019.3 alpha

  1. Necro 8 year old thread
  2. Post something unrelated
  3. ?
  4. Profit
2 Likes