- Home /
Disable one GUI Button with my Mouse Scroll Wheel?
Hello Everyone,
I'm trying to disable one GUI Button with my Mouse Scroll Wheel "when is spinning",
Now I can disable the button with the forward rotation wheel, but not with the to back rotation wheel.
Please any advice is more than welcome!
function OnGUI(){
if (Input.GetAxis("Mouse ScrollWheel") < 0){
button = false;
}else{
button = true;
}
if (Input.GetAxis("Mouse ScrollWheel") > 0){
button = false;
}else{
button = true;
}
Answer by liszto · Feb 08, 2013 at 12:05 PM
Did you try to do this in only one test statement :
if (Input.GetAxis("Mouse ScrollWheel") < 0 || Input.GetAxis("Mouse ScrollWheel") > 0)
button = false;
else
button = true;
EDIT : With Bunny answer ==>
if (Input.GetAxis("Mouse ScrollWheel") == 0)
button = true;
else
button = false;
And with real Bunny answer which as the same result than others :
button = (Input.GetAxis("Mouse ScrollWheel") == 0;
Just for the record, your statement is the same as:
button = (Input.GetAxis("$$anonymous$$ouse ScrollWheel") == 0;
Hello Bunny83 I don't understand, what should be the way to put my script?
Thanks for your Help :)
indeed Bunny, I think it just after but I was too lazy to change my if statement ^^''
Paco don't forget to validate if the answer is correct to close it.
I edit my answer with Bunny answer !
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
Help with GUI clicking ??? 1 Answer
Unity GUI Button Options 0 Answers
Custom GUI Button is Black 1 Answer