I need to have two players moving in a level for a school project and my player controller is already set up for using axis inputs (as opposed to discreet buttons) for directional input. I already know I can assign custom key inputs from the inspector if I just declare a public variable (initialization optional because there is a drop-down list in the inspector):
public KeyCode jumpInput = KeyCode.Space;
How can I assign custom directional axis inputs from the inspector? I already have alternative horizontal and vertical axes defined in my preferences, I just need to know how to assign them.
Been putting this project together for 36 CONTIGUOUS hours and I am ready to put it (and myself) to bed. Thank you in advance for your time.
EDIT: My confusion was coming from (beyond being awake too long) thinking that I needed a special data type (like KeyCode) for an Axis, and couldn't find it in the reference. But I didn't consider making a public string and plugging that into the input. This way, I just need to know what I named the new axes and use that for the public string.
public string horizontalAxisName = "Player1Horizontal";
then usingGetAxis(horizontalAxisName)
to read it? For player 2, you'd just change the string in the inspector to read "Player2Horizontal" instead, a pure data change with no code changes required. What specific behaviour are you unable to achieve in this way? \$\endgroup\$