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.
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).
To help users post good questions and use the site effectively we have posted a user guide. Please check it out.
Answers and Comments
No one has followed this question yet.
Scroll Wheel Mac vs Windows
Why can't I grab the screen anymore?
How do I add a scroll bar to this code or make the current one on here work; this is for iOS. So when thee player clicks the screen, he or she, can scroll down with their finger.
Implementing the ScrollWheel:
how do i set up the mouse wheel?