Help with custom input code? (individual axis' "buttons")

I coded a custom input system that allows me to use axis triggers (for Generic controllers) as buttons. It is activated by checking for a public boolean in my gamepad script. This is what I have so far:

private bool tap;
public bool _GetTapped(int buttonIndex){
        int i = buttonIndex;
        if(Buttons[i].axisEnabled){
            if(Input.GetAxisRaw(Buttons[i].AxisName) == 0 && tap){
                tap = false; //disable the "tap" bool if the axis is no longer held down
            }
            if(Mathf.Abs(Input.GetAxisRaw(Buttons[i].AxisName)) * invertAxis > 0){
                if(tap){
                    return false; //So it doesn't continuosly return true
                }
                else{
                    tap = true;
                    return true;
                }
            }
            return false;
        }
        //If the button isn't axis controlled, simply use the joystick button keycode
        return Input.GetKeyDown(buttonKeycodes[i]);
    }

This allows me to press the axis button and it only returns true once. However, if I check for two different axis-based “buttons” in one update function, only the first “button” is recognized.

        if(gamepad._GetTapped(7) && onGround){
            anim.Play("light attack u");
        }
        if(gamepad._GetTapped(8) && onGround){
            anim.Play("heavy attack u");
        }

This is because of the tap boolean (I believe). I’m just not sure where to properly place it. My goal is to make each check for an axis “button” individual instead of only one “button” being recognized.

Is there any way around this? (perhaps using unique ID’s for each button press?)

You could just create an array of booleans one for each button:

private bool tap[NUM_BUTTONS];
public bool _GetTapped(int buttonIndex){
        int i = buttonIndex;
        if(Buttons[i].axisEnabled){
            if(Input.GetAxisRaw(Buttons[i].AxisName) == 0 && tap[i]){
                tap[i] = false; //disable the "tap" bool if the axis is no longer held down
            }
            if(Mathf.Abs(Input.GetAxisRaw(Buttons[i].AxisName)) * invertAxis > 0){
                if(tap[i]){
                    return false; //So it doesn't continuosly return true
                }
                else{
                    tap[i] = true;
                    return true;
                }
            }
            return false;
        }
        //If the button isn't axis controlled, simply use the joystick button keycode
        return Input.GetKeyDown(buttonKeycodes[i]);
    }

I tried this by embedding individual bools into the button class but the issue remains. The animation doesn’t play as the button script never gets returned as “true”.

I made a debug.log line just to see if the press was at least recognized, it was. The button script just doesn’t get that return.

It seems like it should be very, very simple.

if(Mathf.Abs(Input.GetAxisRaw(Buttons[i].AxisName)) * invertAxis > 0){
          if(Buttons[i].AxisTap){
               return false; //So it doesn't continuosly return true
          }
          else{
              Debug.Log("This is button has been tapped");
              Buttons[i].AxisTap = true;
              return true;
          }
}

The Debug.log line is right above the line that returns “true” for the entire boolean function. So if the boolean function can print in the debug console why can’t it return “true” back to the if statement?