Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

XBox 360 Button Mapping Issues

Discussion in 'Editor & General Support' started by cbowen02, Sep 20, 2016.

  1. cbowen02

    cbowen02

    Joined:
    Jan 25, 2016
    Posts:
    3
    I have no idea as to how I assign "walk" to a specific button on an xbox controller. Seemingly basic keyboard functions (and some joystick) are already assigned when opening input manager. Jump is pre-assigned to a button on the controller AND the keyboard, and this is reflected in the input manager. Why does "Walk" work when using left shift, yet is not mapped to a button on the controller? Better yet, why does the left shift to walk assignment not even show up in the input manager? Has to be somewhere... or it wouldn't work. I would like a SIMPLE and HELPFUL solution or advice that is understandable.

    That being said, a good portion of the forum questions come from people who are beginners, and have little to no experience with coding. People like to try new things, and eventually learn. Everyone starts at the beginning. Coming here for help and answers is discouraging at best, and sometimes downright mean or hurtful. The majority of the answers or "help" these people get are from those of you who want to display your God-like knowledge of Unity and coding with extremely difficult or sarcastic answers for the newcomer. This turns a lot away from wanting to learn to use Unity, and possibly learn to code on their own. If Unity wants to save a lot of wasted time on noobs, and reserve their engine and editor for the elite only, have a friggin test to pass in order to even download. Those of you who are actually decent human beings that sincerely want to help and teach people to learn, Thank You very much!
     
  2. NickAtUnity

    NickAtUnity

    Unity Technologies

    Joined:
    Sep 13, 2016
    Posts:
    84
    I'm not sure which action you're talking about in the Input Manager as "Walk" is not a default input when I make a new project. There is a "Fire3" action which is mapped to the Left Shift button as well as Joystick Button 2 (whichever button that is), but nothing named "Walk".

    That said the Input Manager is customizable and should be tuned for your game. The manual has some good information you can check out: https://docs.unity3d.com/Manual/class-InputManager.html. You can add/remove entries to fit the needs of your game and map them to whatever you think is appropriate. Users get a chance on startup to customize the controls if you leave the launcher window enabled.

    Mapping to specific gamepad buttons in the current version of the input system is a little bit of an effort in frustration, unfortunately, as the joystick buttons are not clearly defined in a way that you might expect. Worse is that it's driver specific and varies across platforms. The community put together a good wiki page showing the mappings: http://wiki.unity3d.com/index.php?title=Xbox360Controller

    The team is working on a new input system which should hopefully make input a much nicer system inside of Unity: https://sites.google.com/a/unity3d.com/unity-input-advisory-board/. That said, the new input system is in active development with no specific ETA so I wouldn't wait for that to start your game.

    Lastly there are a few different assets on the Asset Store that also strive to simplify input and keep things more consistent. I won't play favorites and name any, but check out the Asset Store and the forums and you'll find people discussing some of the more popular input components.
     
    pachermann likes this.
  3. cbowen02

    cbowen02

    Joined:
    Jan 25, 2016
    Posts:
    3
    Thank you very much for the response. I suppose I should clarify a bit. Using wired Xbox 360 controller, the third person character runs by default, and one must hold left shift to walk. In the input manager, I have managed to set up basic controls and mouse look on sticks and they work fine. Jump is assigned to space/joystick button 3 by default, and works fine. So... even though Fire 3 has a default mapping of left shift and joystick button 2, why does my character not walk instead of run when I hold joystick button 2?
     
  4. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,486
    This would depend on how your character script is set up to handle walking. Did you make the script yourself or are you using something pre-existing? If the latter, it's very possible the input code used simply checks the value of Left Shift directly with Input.GetKey(KeyCode.LeftShift). I don't think "Fire 3" would be used to make a character walk.
     
  5. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,548
    If you are looking for a third party solution for input I can highly recommend Rewired in the asset store.

    https://www.assetstore.unity3d.com/en/#!/content/21676
     
  6. sstrong

    sstrong

    Joined:
    Oct 16, 2013
    Posts:
    2,183
    Maybe you could share with us a code segment and the Input Manager entry for the xbox button so that we can see what's going on. Are you testing for Input with Input.GetButton("mybuttonname") && Input.GetKey(KeyCode.LeftShift) or something else?

    For walking you may also wish to use an axis Input.GetAxis("my xbox walk axis") or similar rather than a button. Typically on xbox 360 (or xbox one) you'll want to use the left joystick. See the above link by Nick to get the Input Manager configurations.

    If you don't want to do A LOT of testing, Guavaman's Rewired asset is a good (paid) option. It will do all the Input Manager configuration for you.