- Home /
Multiple controller buttons Xbox 360 & PS3 different controllers
I have a 2 player game and each player has their own script with their own button and joystick names. E.g the PS3's triangle button in the code and Edit-Input manager is "PS3_Triangle" and the 360's Y button is "X360_Y" in the code and Edit-Input Manager. The joysticks work fine with only the 360 controller moving only the first player and the PS3 controller moving only the second player. Now the buttons are EXTREMELY annoying for me. The Y button is supposed to jump only for the first player and the Triangle button only on the second player, but for some reason the Y button and Triangle button control both players (well actually all the buttons control the other player as well.) I want a way that only the Y button on the 360 controller jumps only for player 1 and the Triangle button jumps only for player 2. In the Input Manager, the positive button slot, I have it named "joystick button 3" for the Y button on 360 with the Joy Num set to Joystick 1 and the slot named "joystick 0" for the Triangle button on PS3 with the Joy Num set to Joystick 2. Each player's script calls for the button that's supposed to do an action but for some reason the other controller's button can do the same for it. Would the problem be in Input Manager or in my code? I doubt that it's my code because the joysticks only move the player that their supposed to move. I could really use some help since I'm a sophomore in highschool and we're barely starting Unity this year. I'm not sure if this helps, but the name for the Y button is "X360_Y" and the name for the Triangle button is "PS3_Triangle" and that's what the script references. Below is a sample of the script for the RB button 360 controller. The script is C# if (Input.GetButtonDown("X360_A") && aim == true) { svumode = 2;// animation mode camera1.GetComponent().fieldOfView = 60;// camera depth = 60 aim = false; GameSettings.Sens = 10;//mouse sensitivity = 1 }
the script posted above is for the 360 controller. The one for PS3 buttons just says what I named them. Please help me with this problem. I will be as clear as possible.thanks
Answer by metalted · Feb 27, 2017 at 10:56 PM
If i may quote some Jackson 5, Multiplayer isn't as easy as 1 2 3. Like you said, you are barelly starting out with Unity. Dont know how your coding skills are, but if you just started coding, i think this is a bit out of reach. Being able to create what you want, you have to know how to work the input manager, use controllers and more important use 2 different controllers that have different settings and behaviours.
What you want is not impossible, but it takes time to learn, to create and test. If i were you I try to take little steps to get where you want to be and learn as much as you can along the way.
How I would do this: -Make the game single player first. -Try multiplayer by sharing a keyboard. -Try adding 1 controller, best guess is probably the 360.
If you done that, you might have gotten the knowledge to make the Input manager do what you want. Then try to add the PS controller. The idea of doing this already gives me a headache. But its probably not impossible.
Your answer
Follow this Question
Related Questions
Platform Dev Pricing 1 Answer
Mapping multiple controllers 1 Answer
Unity reading brand of controller 1 Answer
Controller shoulder buttons firing both at the same time. 0 Answers
Triggers on the 360 controller treated as one axis? 3 Answers