- Home /
Is there a way to temporarily disable an inputmanager axis through script?
So I have some inputs that are set to mouse 0 and mouse 1, but when I have a GUI open I don't want those inputs to be recognized, because when the player clicks on a GUI button then they also, for example, turn on their flashlight simultaneously. You could see why this might be problematic. Any way to go about fixing this? Thanks for any help!
Answer by siaran · Mar 10, 2015 at 11:24 PM
Im half-asleep but something like:
bool buttonOpen;
void Update(){
if(buttonOpen) return;
else {
float whatever = Input.GetAxis("axisname");
//Do whatever
}
}
basically use a boolean to check if your GUI is open and only handle the input in your code if it isn't.
Your answer
Follow this Question
Related Questions
Unity built-in axes - how do they work? 1 Answer
Replacing the Input Manager Asset with your own 2 Answers
Multiple Cars not working 1 Answer
How to read the input manager from a script 1 Answer
Distribute terrain in zones 3 Answers