What you can do is get the button and then check for the corresponding axis, like so:
if (Input.GetButtonDown("Horizontal") && Input.GetAxisRaw("Horizontal") > 0) {
// Move to the right
}
else if (Input.GetButtonDown("Horizontal") && Input.GetAxisRaw("Horizontal") < 0) {
// Move to the left
}
Also be aware that the axis is set to SNAP. This means a change of direction instantly sets the axis to 0.
↧