Is there a way to detect when the mouse wheel has been scrolled up or down? I'm trying to create a camera script where the mouse wheel is scrolled to zoom in and out.
Answer by StephanK
Oct 31, 2010 at 11:17 PM
Try Input.GetAxis("Mouse ScrollWheel")
I don't have an axis named Mouse ScrollWheel.
That is a standard axis that is predefined in Unity. If you somehow deleted it you can always setup your own axis in the InputManager (Edit->ProjectSettings->Input). Just set Type to MouseMovement and Axis to 3rd axis.
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users post good questions and use the site effectively we have posted a user guide.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
Answers and Comments
No one has followed this question yet.
Implementing the ScrollWheel:
how do i set up the mouse wheel?
Mouse Wheel Zoom
Mouse ScrollWheel and character Y axis movement
Scroll Wheel not working on Mac