Search Unity

Resolved Best way to change controls based on game context?

Discussion in 'Input System' started by PaperMouseGames, Oct 6, 2021.

  1. PaperMouseGames

    PaperMouseGames

    Joined:
    Jul 31, 2018
    Posts:
    434
    Hi there! I'm new at using the new Input system in Unity and I was wondering about changing the types of controls available to the player base don what is happening in the game.

    So I set up a Player Actions (Input Actions) with some basic WASD movement and spacebar jumping.

    What I want to do, is change the controls for when the player is swimming, or riding a mount for example. In the swimming example I though, maybe I want spacebar to move the player smoothly vertically rather than jumping.

    So if I want to do this, would I create a new Input Actions? like Player Swimming (input Actions) with new controls?

    I saw there is an option for creating a "New Control scheme" in my current Input Actions, but from what I can see reading online and such, that';s used more for changing the input device controls.

    So if I want to make a different set of controls depending on the situation in my game, would I create a new input action, control scheme, or something else I'm not familiar with?

    I appreciate the help!
     
  2. PaperMouseGames

    PaperMouseGames

    Joined:
    Jul 31, 2018
    Posts:
    434
    I think I got this figured out actually! Action Maps seem to be the way to go, I think I was confused as to how they work because I didn't know you could have multiple action maps active at one time.

    So my solution right now is to have a land action map, a swim action map, and a global action map.

    So I switch between the land and swim action maps as needed, and then the global action map stays active all the time, and that one does things like opening up the menu or inventory screens.

    This is working really well, so hopefully it helps someone else if they run into the same question!