- Home /
How do I reverse a method call?
This might be a strange ask. There's the method AccelTimer() that I want to initiate in Update(), but if a button is pressed, I don't want AccelTimer() to be called. Is there a clean way to go about this? Thank you!
AccelTimer();
if (Input.GetKey(KeyCode.Mouse0) || Input.GetKey(KeyCode.Mouse1))
{
!AccelTimer(); //Or whatever it may be. I'm not sure how to do this part.
}
else
{
AccelTimer();
}
Answer by tanoshimi · Sep 27, 2016 at 10:15 AM
You don't want to reverse the method - you want to reverse the condition on which the method is called:
if !(Input.GetKey(KeyCode.Mouse0) || Input.GetKey(KeyCode.Mouse1))
{
AccelTimer();
}
Thanks @tanoshimi, your solution worked out fine :] Yeah I hear reversing a method isn't really a thing haha, I appreciate the input.
Your answer
Follow this Question
Related Questions
Variable Not Changing In Method 1 Answer
MethodInfo listing functions and parameters of a public variable 2 Answers
cant change variable from a method? timer stays at 0! 1 Answer
Entering false statement even it is at true state. 1 Answer
Trying to run 5 instances of a static method at once to do an action, probably a dumb thing to do? 0 Answers