Where are these unexpected GetButtonDown events coming from?

I’m trying to register distinct button presses from different joysticks i have plugged in, but somehow the code i have acts as though the buttons of all joysticks are being pressed at once when any of them is pressed. I think I’m making a simple mistake somewhere:

Here’s how my inputs are set up: http://imgur.com/k6qMW

alt text

I have the following script attached to my camera in my otherwise empty scene:

 function Update () {
     var j=0;
     while(j<3){
     var f = Input.GetButtonDown("FireButton"+(j+1));
     if(f){
     Debug.Log("FireButton:"+(j+1));
     }
     j++;
     }
    }

What I was expecting is that when I pressed the first firebutton on my first joystick, i’d get a single log item: “FireButton:1”. But instead I get three items printed to the console: “FireButton:1”, “FireButton:2”, “FireButton:3” and I’m not understanding why. Can anyone point out where I’m going wrong here?

Looks to me like ‘joystick button 0’ is used for all your soft buttons. Try changing those. As it is now, I would expect the exact behavior you are seeing.

Have you mapped the joystick controls to the input manager?

Also, input is generally handled as the following:

void Update() {
    if(Input.GetButtonDown("Fire1")) {
        // do something pertaining to that button
    }
}