How to not allow diagonal movement?

So I am trying to create a topdown player movement script where the player can only move up, down, left and right. Right now though my character can move diagonally if I hold the W and D keys. Is there a way to disable diagonal movement?

So here is how I figured out how to do it. Basically used a bunch of bools lol. If anyone knows of a simpler way to do it please let me know :).

An easier way could’ve been simply checking that ForwardInput>RightInput (if sending forward), and swapped for Right.

I think an easier way to do it would be to store the axis values into their own variables, then use a branch to see if move forward’s (absolute) axis value is greater than moveright (absolute) axis value. if true, then move forward. do the exact opposite for moveright event. This should essentially check to see if your stick is more pointed in one axis or another. This would work for your stick on a controller.

For WASD, I would have moveforward set a boolean that disables a branch on moveright, and viceversa. You would have to implement on button release to set those booleans back to allow input again though. but this should cut out many operations

Not at home, so you’ll have to tell me if it works

Hello is it possible for you to make a video on this?

Where I can find this option??