Hello, guys.
So we use the example of the input in the previous video.
Now, I just want to give you some info on how this works, how the input works.
We use an old input system and it's called all the input system because it is well, it is the old one.
There is a new one and new one has benefits compared to this one.
But the old input system is just simple to understand.
And when you don't have like kind of a huge project in front of you, then it's nothing bad to use all
the input system.
You know, I think it would be better if they would call it like simple input system and advanced input
system, something like that.
So how it works, you can type input dot and there are a couple of ways to use it.
There are you can get mouse position, you can even detect multitouch and so on and so on.
But we're going to mostly use get key down, get key or get button.
Right.
So what is the difference between get key and get button get key using key code so this one and give
key itself returns true while the user holds the button so we can use the gate key.
If user holds the button, get key down works when player pressed the button and it's just begun to
go down.
Like once it was pressed just now it worked.
And then get key app works when player release the button to check that.
Let's go to update again and do if input get key down E code M let's say I don't know why just M debug
log button down then let's make another one.
If input get key down and get key app key code M debunked log button app and just one more if input
get key and key code M debugger that log button held.
I'm not sure about the spelling, but whatever.
Now in the play mode.
Look, I press my button and I got three messages down, held and up.
If I press the button and hold it, I can see that button down was called only two times and button
held is called all the time.
And by the way, if you see your messages like this, just click collapse button over here.
Yeah.
Now, if I release the button, it goes button up.
So this hot works button down one button held all the time up, button up there.
Another way.
There is something else you should know.
There is input of get button.
Yeah.
They using the same rule.
The only difference is let's use get button down.
We don't use key code here we can.
The only difference here you can use string to find button name.
So I'll just type here jump and I'll do debug log jump.
Now how do I know what is jump.
Where did I get this name even how can I find it?
It's very simple.
You go to Unity, edit project settings and you find input manager, click this arrow and you have all
of the buttons that were created by default and you can make more of them.
Like if you type here 31, you get an extra and you can change it as you like, name can be a and you
just need to assign key for this and then it will be used.
And the one we used is jump.
Jump has joystick button by default and it should have space as well.
But I guess I this is for joystick, right?
There is another one for keyboard space.
So basically, if we use this jump instead of key code, we can use GAMEPAD and we can use keyboard.
If we use just key code we can use on the keyboard.
And it's like that.
So maybe let's keep this one in case you want to play with the gamepad, but it's an endless runner.
I don't know one button why you need gamepad for that and let's go and check it out and then I'm going
to show you some extra info on that and we're going to move to next video.
So boom, jump in working.
Cool.
Now, something else to know about this.
In the Google, you can type unity key code.
You'll have basically the first link.
And here you can see the same info I just told you.
Plus, and there is a key code for all of the buttons over here, so if you need some special, you
can find it here as well.
You can find them in the Visual Studio just by typing key code dot and it will be here.
All right.
That's it.
We are done here.
Let's go to next video.