You can automatically change the value of a slider with a controller. But this is at a fixed increment? My slider is set to [float] 0-100 and when using a controller or keyboard [new input system] the value is changed at a fixed increment of 10. I tried applying a processor to the action map to maybe change the axis value but this doesn’t work. Is there a setting or a way to go about without scripting a slider specifically for controllers and keyboards?
Hi NollathTheWeary,
Your suggestion is quite interesting as a feature for our standard slider. Our primary target was the Editor with a keyboard and mouse, where partial increments aren’t possible, but I don’t see any reason we couldn’t support your scenario for a controller out of the box.
In the meantime, there is a way for you to make this work without changing the existing controls and without being specific about the hardware you’re using. If you look at the source code for the Slider, you’ll see that the base class BaseSlider registers a callback to NavigationMoveEvent, where it does a few checks and moves the slider according to the move direction. You can register your own callback to NavigationMoveEvent and make it execute before the built-in one, using
mySlider.RegisterCallback<NavigationMoveEvent>(MyNavigationMove, TrickleDown.TrickleDown);
, where mySlider is your slider instance (or this if you’re making a Slider subclass), and where MyNavigationMove is your custom callback that reads the NavigationMoveEvent.move property and does finer-grain operations with it. Be sure to stop the propagation to prevent the event from reaching the existing BaseSlider callback, and to use focusController.IgnoreEvent to prevent direction navigation to other elements.