- Home /
Input Axis Mouse ScrollWheel
I am loosely following a tutorial on some basic gun mechanics. Changing weapons is one of them. Here is the error i receive
ArgumentException: Input Axis Mouse ScrollWheel > 0 is not setup. To change the input settings use: Edit -> Project Settings -> Input ChangeGun.Update () (at Assets/Scripts/ChangeGun.js:7)
When i go to Edit -> Project Settings -> Input I dont know what the middle mouse button is, or what i need to change about it.
Here is my script. Any thoughts?
#pragma strict
var weaponnum : int = 0;
function Update () {
if(Input.GetAxis("Mouse ScrollWheel > 0") && weaponnum < 1 && Input.GetMouseButtonDown(1) == false)
weaponnum++;
if(Input.GetAxis("Mouse ScrollWheel > 0") && weaponnum > 0 && Input.GetMouseButtonDown(1) == false)
weaponnum--;
}
Answer by zach-r-d · Jun 11, 2015 at 04:03 AM
Ah, you probably meant to have the "> 0" outside of the Input.GetAxis call like so:
function Update () {
if(Input.GetAxis("Mouse ScrollWheel") > 0 && weaponnum < 1 && Input.GetMouseButtonDown(1) == false)
weaponnum++;
if(Input.GetAxis("Mouse ScrollWheel") > 0 && weaponnum > 0 && Input.GetMouseButtonDown(1) == false)
weaponnum--;
}
Depending on the behavior you want, the second "> 0" might be better off as "< 0"
Oh man that was causing so many issues. I cant believe i over looked that. Thank you a ton.
Your answer
Follow this Question
Related Questions
Input.GetMouseButtonDown(0) running through my if statments too quickly 1 Answer
Multiple Constant Force Inputs at once? 1 Answer
Mouse input erratic 1 Answer
Move player with mouse help 0 Answers
Mouse axis wont change an integar. 1 Answer