• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by Wandusprime · Dec 08, 2015 at 06:03 AM · inputmanagermousewheel

Is there a way to use the mouse wheel as a normal button, instead of an axis?

I just want 2 normal button style inputs in the Input Manager, just scroll up and scroll down. Is this possible?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Yuvii · Dec 08, 2015 at 10:16 AM

Not sure, but you can use the axis the way you want to.

 int SW = Input.GetAxisRaw("Mouse ScrollWheel");
 
 if(SW == 1){
 // You're scrolling up
 }
 else if(SW == -1){
 // You're scrolling down
 }

This is the same as a

 if(Input.GetKey(...))

But since there's not really a 'press down' and a 'press up' on the scroll wheel axis, if you want to swith weapon for example and you want it to switch only on the next or on the previous weapon on your list, you should add a SW = 0; on the end of both conditions, but not sure if this'd work.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Wandusprime · Dec 08, 2015 at 05:46 PM 0
Share

yeah i suppose there isn't a press down and up. alright, ill probably just go with what you have here, thanks :)

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

34 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Cross-Platform Input 3 Answers

XboxCtrlrInput Dead Zone 0 Answers

Checking input from input.manager axes? 1 Answer

why is moving mousewheel zooming in too much?,when scrolling the mwheel, why does the scene view camera move too much? 0 Answers

This is weird - Assembly hi could not be loaded 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges