Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to make a simple weapon change in Unity3D. The best way to do this is with the mouse scroll wheel, as far as I can see.

I googled on how to do this and found that I have to use Input.GetAxis("Mouse ScrollWheel"); I use this piece of code and print it. Still, I always get an value of 0. any ideas? I just need to solve how to get the value first, I'll figure out the rest myself.

Code idea:

function Update () {

    if(Input.GetAxis("Mouse ScrollWheel")){
    WeaponNumber += Input.GetAxis("Mouse ScrollWheel");
share|improve this question

In addition to using the code you have above you need to configure the axis in the input manager and name it correctly.

The accepted answer here may be of help:

share|improve this answer
Correct, thank you for clearing this up! – BallzOfSteel Apr 19 '11 at 6:53
@BallzOfSteel, if you are satisfied with an answer, please click the accept answer button. – AttackingHobo Apr 27 '11 at 16:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.