Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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 () {
    print(WeaponNumber);

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

1 Answer 1

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: http://answers.unity3d.com/questions/6106/implementing-the-scrollwheel

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

 
discard

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.