Answer the question
In order to leave comments, you need to log in
How can i convert if?
How can I and can I even convert a lot of if with (Input....) Example:
int i;
void example ()
{
if(Input.GetKeyDown(KeyCode.1){
i = 1;
}
if(Input.GetKeyDown(KeyCode.2){
i = 2;
}
if(Input.GetKeyDown(KeyCode.3){
i = 3;
}
}
Answer the question
In order to leave comments, you need to log in
In the general case, no - anyway, in some place you will be called by Input.GetSomethingThere.
And through the chain of ifs, there is the most effective option (unless, of course, you check only those buttons that make sense to check)
But it seems like some new input system has appeared in Unity, which should be more flexible:
https://gamedevbeginner. com/input-in-unity-made-ea...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question