How to prioritize one button input over another

I have 3 guns on a spaceship. I want to set up a script so that I can only be shooting one gun at a time.

Example: I want it set up in a way where if I hold down “Fire1”, then hold down “Fire2” the script will prioritize the most recent button press of “Fire2”, but if I let go of “Fire1” then press “Fire1” button again, “Fire1” gun will shoot because it was the most recent button pressed.

Thanks for any help you can provide!

Maybe use ButtonDown and ButtonUp (so only register the input on the first frame you press it and release it) and set bool variables for whether each gun is firing to true or false. That way if you input a button on any frame, you could get it to set the other weapon bools to false and its to true. idk. That way its just based on which Input.GetButton/axis/keyDown was pressed last.