Is it possible to remove keyboard input for the UI slider?

I have a panel of UI which contains mostly of sliders. I have a script which uses W,A,S,D to move around. Whenever I try to move around with W,A,S,D it alters the value of the slider as well which is very annoying.
Is there any way i can disable the keyboard input

You could also set Navigation to None which means no keyboard navigation.


for more details, please look at here: Redirect to... title of new-page

Here’s a conceptual answer. You can possibly make a new class which inherits from the UI Slider, then override the keyboard input.

It inherits from several interfaces and has lots of methods you can override. Hope that helps.

I would guess that the UI is reading from the Horizontal and Vertical axes configured via the InputManager.

I don’t know if you are actively using those particular axes in your code or if you are reading the keys directly, but one fix would be to remove WASD from those axes. You can do this from the editor by going to Edit → Project Settings → Input.

Setting Navigation to None didn’t stop my slider receiving horizontal input. I also didn’t want to disable all keyboard navigation, so @bartm4n’s wasn’t viable either.

Instead I started from @NorthernVisionStudio’s hint, and came up with the below. To use it you replace the regular Slider component on a GameObject with the SliderSelectable component.

public class SliderSelectable : Slider {
    public override void OnMove(AxisEventData eventData) {
        if (eventData.moveDir == MoveDirection.Left || eventData.moveDir == MoveDirection.Right) { return; }