Configuring input from a mouse scroll wheel

Newbie first post, woop.

Some brief searching hasn’t helped me and I’m not the most competent programmer in the world. What I’d like to do is make a selection based on whether the scroll wheel is being scrolled forwards, backwards, or is stationary.

I’m aware of Input.GetButton() for normal inputs, but I’m not quite sure how everything works in this instance. Any help is much appreciated. :slight_smile:

You read the scroll wheel using an axis (maybe you could do it some other way as well, but using an axis is how I did it).

In Unity meny “Edit / Project Settings / Input”, add an Axis called e.g. “Mouse Scrollwheel”. As “Type”, choose “Mouse movement”. As “Axis”, choose “3rd axis (Joysticks and Scrollwheel)”.

In your code, use:

Input.GetAxis("Mouse Scrollwheel")

Good luck!

3 Likes

Awesome, my minimap now zooms in and out. Thanks very much. :slight_smile: