1
00:00:00,000 --> 00:00:00,000
Hello, guys.

2
00:00:00,000 --> 00:00:03,000
So we use the example of the input in the previous video.

3
00:00:03,000 --> 00:00:10,000
Now, I just want to give you some info on how this works, how the input works.

4
00:00:10,000 --> 00:00:17,000
We use an old input system and it's called all the input system because it is well, it is the old one.

5
00:00:17,000 --> 00:00:21,000
There is a new one and new one has benefits compared to this one.

6
00:00:21,000 --> 00:00:24,000
But the old input system is just simple to understand.

7
00:00:24,000 --> 00:00:31,000
And when you don't have like kind of a huge project in front of you, then it's nothing bad to use all

8
00:00:31,000 --> 00:00:32,000
the input system.

9
00:00:32,000 --> 00:00:38,000
You know, I think it would be better if they would call it like simple input system and advanced input

10
00:00:38,000 --> 00:00:39,000
system, something like that.

11
00:00:39,000 --> 00:00:46,000
So how it works, you can type input dot and there are a couple of ways to use it.

12
00:00:46,000 --> 00:00:53,000
There are you can get mouse position, you can even detect multitouch and so on and so on.

13
00:00:53,000 --> 00:00:59,000
But we're going to mostly use get key down, get key or get button.

14
00:00:59,000 --> 00:00:59,000
Right.

15
00:00:59,000 --> 00:01:05,000
So what is the difference between get key and get button get key using key code so this one and give

16
00:01:06,000 --> 00:01:11,000
key itself returns true while the user holds the button so we can use the gate key.

17
00:01:11,000 --> 00:01:17,000
If user holds the button, get key down works when player pressed the button and it's just begun to

18
00:01:17,000 --> 00:01:18,000
go down.

19
00:01:18,000 --> 00:01:21,000
Like once it was pressed just now it worked.

20
00:01:21,000 --> 00:01:27,000
And then get key app works when player release the button to check that.

21
00:01:27,000 --> 00:01:37,000
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

22
00:01:37,000 --> 00:01:41,000
log button down then let's make another one.

23
00:01:41,000 --> 00:01:56,000
If input get key down and get key app key code M debunked log button app and just one more if input

24
00:01:56,000 --> 00:02:02,000
get key and key code M debugger that log button held.

25
00:02:02,000 --> 00:02:05,000
I'm not sure about the spelling, but whatever.

26
00:02:05,000 --> 00:02:06,000
Now in the play mode.

27
00:02:06,000 --> 00:02:13,000
Look, I press my button and I got three messages down, held and up.

28
00:02:13,000 --> 00:02:21,000
If I press the button and hold it, I can see that button down was called only two times and button

29
00:02:21,000 --> 00:02:23,000
held is called all the time.

30
00:02:23,000 --> 00:02:28,000
And by the way, if you see your messages like this, just click collapse button over here.

31
00:02:29,000 --> 00:02:29,000
Yeah.

32
00:02:31,000 --> 00:02:34,000
Now, if I release the button, it goes button up.

33
00:02:35,000 --> 00:02:42,000
So this hot works button down one button held all the time up, button up there.

34
00:02:42,000 --> 00:02:44,000
Another way.

35
00:02:44,000 --> 00:02:45,000
There is something else you should know.

36
00:02:45,000 --> 00:02:50,000
There is input of get button.

37
00:02:50,000 --> 00:02:50,000
Yeah.

38
00:02:50,000 --> 00:02:52,000
They using the same rule.

39
00:02:52,000 --> 00:02:54,000
The only difference is let's use get button down.

40
00:02:54,000 --> 00:02:57,000
We don't use key code here we can.

41
00:02:57,000 --> 00:03:01,000
The only difference here you can use string to find button name.

42
00:03:01,000 --> 00:03:06,000
So I'll just type here jump and I'll do debug log jump.

43
00:03:06,000 --> 00:03:08,000
Now how do I know what is jump.

44
00:03:08,000 --> 00:03:12,000
Where did I get this name even how can I find it?

45
00:03:12,000 --> 00:03:13,000
It's very simple.

46
00:03:13,000 --> 00:03:22,000
You go to Unity, edit project settings and you find input manager, click this arrow and you have all

47
00:03:22,000 --> 00:03:27,000
of the buttons that were created by default and you can make more of them.

48
00:03:27,000 --> 00:03:36,000
Like if you type here 31, you get an extra and you can change it as you like, name can be a and you

49
00:03:36,000 --> 00:03:40,000
just need to assign key for this and then it will be used.

50
00:03:40,000 --> 00:03:42,000
And the one we used is jump.

51
00:03:43,000 --> 00:03:47,000
Jump has joystick button by default and it should have space as well.

52
00:03:47,000 --> 00:03:50,000
But I guess I this is for joystick, right?

53
00:03:50,000 --> 00:03:54,000
There is another one for keyboard space.

54
00:03:54,000 --> 00:04:03,000
So basically, if we use this jump instead of key code, we can use GAMEPAD and we can use keyboard.

55
00:04:03,000 --> 00:04:06,000
If we use just key code we can use on the keyboard.

56
00:04:06,000 --> 00:04:07,000
And it's like that.

57
00:04:07,000 --> 00:04:12,000
So maybe let's keep this one in case you want to play with the gamepad, but it's an endless runner.

58
00:04:12,000 --> 00:04:17,000
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

59
00:04:17,000 --> 00:04:20,000
to show you some extra info on that and we're going to move to next video.

60
00:04:20,000 --> 00:04:23,000
So boom, jump in working.

61
00:04:24,000 --> 00:04:25,000
Cool.

62
00:04:25,000 --> 00:04:26,000
Now, something else to know about this.

63
00:04:26,000 --> 00:04:30,000
In the Google, you can type unity key code.

64
00:04:32,000 --> 00:04:34,000
You'll have basically the first link.

65
00:04:34,000 --> 00:04:38,000
And here you can see the same info I just told you.

66
00:04:38,000 --> 00:04:45,000
Plus, and there is a key code for all of the buttons over here, so if you need some special, you

67
00:04:45,000 --> 00:04:47,000
can find it here as well.

68
00:04:47,000 --> 00:04:53,000
You can find them in the Visual Studio just by typing key code dot and it will be here.

69
00:04:53,000 --> 00:04:54,000
All right.

70
00:04:54,000 --> 00:04:55,000
That's it.

71
00:04:55,000 --> 00:04:56,000
We are done here.

72
00:04:56,000 --> 00:04:58,000
Let's go to next video.

