- Home /
Changing input sensitivity via scripting (JS)
This.feels.so.noob.
Ok, so I already Google'd this, and didn't get an answer I'm satisfied with, that's why I'm bringing it here.
Here's my problem:
I have a menu script that utilizes the "Vertical" key. (currently testing on keyboard input) In order for the highlighted selection to not always go to the top choice I changed the sensitivity in Unity Input Manager to 0. Works like a charm. EXCEPT that once in game the player won't stop walking. So I set sensitivity back to 3, the default. Works like a charm, EXCEPT now in aforementioned menu script the highlighted text snaps back to the top selection. (Bear in mind that ALL of this has occurred in the editor. No changes were made via script. So my question is this: can I change input sensitivity via script during the game? I really like that setting for each intended use, but am not sure if it can be done. Thanks for any help.
I don't think it should be necessary to change the sensitivity. you're talking about a character which is moving depending on input, with the accelerating from it and all, and a menu, where usually one key tab would mean selecting just the next menu entry. maybe with some holding time for swooshing about the entries.
my question is, how are you changing menu entries that allow for reaching straight for the top.
Think of the menu as an A / B question. It's actually part of character selection at the beginning of the game. The player is asked a question, and then has their choice of one of two possible answers. So, with sensitivity set to 0 they can move the highlighted text between the two answers and the text will stay highlighted until they choose to move the selection. Unfortunately, having the the sensitivity set that way means that once in game the player will continue to walk (or run) once that input key (vertical) is pressed once. The solution kind of would look like this:
$$anonymous$$enu: Sensitivity = 0 (keeps highlighted text from moving)
In Game: Sensitivity = 3 (keeps player from moving when button / key is released)
Answer by YaserDev · Mar 02, 2018 at 03:05 PM
You can declare another "sensitivity" variable in either your menu highlighting script or player movements script, then multiply the value you get from Input.GetAxis("Vertical") with that sensitivity variable. Currently, you can't change the variables of the InputManager from a script, Unity team is actively working on a new Input system that will probably have this feature.
Your answer
![](https://koobas.hobune.stream/wayback/20220612152318im_/https://answers.unity.com/themes/thub/images/avi.jpg)