1
00:00:00,000 --> 00:00:00,000
Hello, guys.

2
00:00:00,000 --> 00:00:05,000
In this video, we're going to adjust our start screen and make this top to start button actually work.

3
00:00:05,000 --> 00:00:06,000
All right.

4
00:00:07,000 --> 00:00:09,000
Let's go to play mode and see what we have right now.

5
00:00:10,000 --> 00:00:15,000
So at the moment, my platform is bound and my player is somewhere below, which is not cool.

6
00:00:15,000 --> 00:00:18,000
What we need to do here is to switch on the player.

7
00:00:18,000 --> 00:00:26,000
And then I want to add an extra platform here to make kind of a base platform that will be always there

8
00:00:26,000 --> 00:00:27,000
no matter what you spawn.

9
00:00:27,000 --> 00:00:33,000
Next, let's unpack prefab of the level part and completely.

10
00:00:33,000 --> 00:00:37,000
Then I'm going to delete start point and end point and limiter.

11
00:00:37,000 --> 00:00:39,000
I don't need it and I can remove script from here.

12
00:00:39,000 --> 00:00:41,000
I don't need it as well.

13
00:00:41,000 --> 00:00:43,000
I want to find my level part.

14
00:00:44,000 --> 00:00:50,000
Zoom it out by bit and just take this platform and move it to the left and make it wider like this.

15
00:00:52,000 --> 00:00:54,000
And maybe put it a bit higher here.

16
00:00:54,000 --> 00:00:57,000
Then I want to take player and move here as well.

17
00:00:59,000 --> 00:01:01,000
Just like this.

18
00:01:01,000 --> 00:01:02,000
Maybe make the platform longer.

19
00:01:02,000 --> 00:01:07,000
So now, no matter what is found with the level generator, the player is going to stand on the ground

20
00:01:07,000 --> 00:01:09,000
and it's going to be fine.

21
00:01:11,000 --> 00:01:13,000
Okay, You see that?

22
00:01:13,000 --> 00:01:14,000
Cool.

23
00:01:14,000 --> 00:01:15,000
Now, let's take little generator.

24
00:01:15,000 --> 00:01:18,000
If you don't have your platforms here, put it there.

25
00:01:18,000 --> 00:01:21,000
I'm going to draw second part and third part.

26
00:01:21,000 --> 00:01:24,000
I have only two good level bars for now.

27
00:01:26,000 --> 00:01:32,000
Now let's see how it is so they could spawn a bit to the right and we can fix that by changing next

28
00:01:32,000 --> 00:01:34,000
position part and increasing the X.

29
00:01:34,000 --> 00:01:41,000
But I don't want to confuse anyone, so let's just take the platform and move it to the left like so,

30
00:01:41,000 --> 00:01:43,000
and move player to the left as well.

31
00:01:43,000 --> 00:01:45,000
Like so then let's see this.

32
00:01:47,000 --> 00:01:47,000
This is better.

33
00:01:47,000 --> 00:01:50,000
Now let's make this stop to start button functional.

34
00:01:51,000 --> 00:01:54,000
First of all, we need to unlock the player.

35
00:01:54,000 --> 00:01:56,000
And I want to do that by going to game manager.

36
00:01:57,000 --> 00:01:59,000
First, I want to get access to the player.

37
00:01:59,000 --> 00:02:02,000
So let's do this public player player.

38
00:02:02,000 --> 00:02:09,000
Then let's create a function that's going to do one line of code, public void and lock player, right?

39
00:02:09,000 --> 00:02:13,000
And here it's going to return player, dot player unlocked.

40
00:02:13,000 --> 00:02:15,000
Oh, I guess it's a private boolean.

41
00:02:15,000 --> 00:02:16,000
So let's go and fix that.

42
00:02:16,000 --> 00:02:21,000
Let's go to player script, find player unlocked, make it public.

43
00:02:23,000 --> 00:02:23,000
But I want to do.

44
00:02:23,000 --> 00:02:25,000
Hide in the inspector.

45
00:02:25,000 --> 00:02:26,000
Hide in, Inspector.

46
00:02:27,000 --> 00:02:27,000
All right.

47
00:02:27,000 --> 00:02:30,000
Now, before, if you remember, we did unlock the player with the button.

48
00:02:30,000 --> 00:02:32,000
Now I want to remove that ability.

49
00:02:33,000 --> 00:02:33,000
Let's go to input.

50
00:02:33,000 --> 00:02:34,000
Check.

51
00:02:36,000 --> 00:02:36,000
Here.

52
00:02:39,000 --> 00:02:41,000
And we can delete this function or we can comment it.

53
00:02:41,000 --> 00:02:43,000
I will just comment out.

54
00:02:46,000 --> 00:02:46,000
So.

55
00:02:46,000 --> 00:02:48,000
Okay, so it's not functional anymore.

56
00:02:48,000 --> 00:02:49,000
Good.

57
00:02:49,000 --> 00:02:51,000
Now let's go to game manager.

58
00:02:51,000 --> 00:02:56,000
And because Player Unlocked is public, now we can get access to that player.

59
00:02:56,000 --> 00:02:58,000
Unlocked equals to true.

60
00:02:59,000 --> 00:03:00,000
Good enough.

61
00:03:01,000 --> 00:03:04,000
Now let's go to UI main and create a function.

62
00:03:05,000 --> 00:03:06,000
Public void.

63
00:03:12,000 --> 00:03:19,000
Start game and we're going to return game manager dot instance dot unlock layer.

64
00:03:19,000 --> 00:03:20,000
Let's go back to canvas.

65
00:03:22,000 --> 00:03:24,000
I want to find this top to start button.

66
00:03:24,000 --> 00:03:28,000
Click plus and drag canvas.

67
00:03:29,000 --> 00:03:31,000
Then find switch two.

68
00:03:31,000 --> 00:03:33,000
And we're going to switch to ingame UI.

69
00:03:34,000 --> 00:03:35,000
That's the first one.

70
00:03:35,000 --> 00:03:37,000
And we can add one more.

71
00:03:37,000 --> 00:03:41,000
It's going to be again, canvas and then UI.

72
00:03:43,000 --> 00:03:45,000
Start game.

73
00:03:45,000 --> 00:03:45,000
All right.

74
00:03:45,000 --> 00:03:49,000
What we could do here is just to drag function from a game manager.

75
00:03:49,000 --> 00:03:51,000
This also would be fine.

76
00:03:51,000 --> 00:03:53,000
Game manager and log player.

77
00:03:53,000 --> 00:03:56,000
That's okay, but I want to keep it organized.

78
00:03:56,000 --> 00:04:01,000
Plus, you never know what kind of functionality you want to add to these function.

79
00:04:01,000 --> 00:04:02,000
Let's do this.

80
00:04:02,000 --> 00:04:02,000
All right.

81
00:04:04,000 --> 00:04:06,000
Sorry I did this while I was talking.

82
00:04:06,000 --> 00:04:08,000
Make sure you have the same canvas.

83
00:04:08,000 --> 00:04:11,000
Switch menu to canvas start game.

84
00:04:13,000 --> 00:04:14,000
Good.

85
00:04:14,000 --> 00:04:19,000
So what I was saying is you never know when you're going to change the functionality of your function.

86
00:04:19,000 --> 00:04:25,000
Maybe I want to add some stuff here that is relatable to UI only, and then I would have to create a

87
00:04:25,000 --> 00:04:30,000
function, but now I have a function that I can edit if I need to.

88
00:04:30,000 --> 00:04:33,000
So it's kind of a good practice to keep everything at one place.

89
00:04:33,000 --> 00:04:39,000
So later, for example, imagine you open this game after a month or so, and if you go to you, I mean

90
00:04:39,000 --> 00:04:41,000
you clearly can see your switch menu too.

91
00:04:42,000 --> 00:04:47,000
And you choose a menu and you start game by unlocking the player with a function.

92
00:04:47,000 --> 00:04:53,000
But if this would not be here, for example, if we would have just drag function from game manager,

93
00:04:53,000 --> 00:04:57,000
it might be difficult to find how you even unlock in the player.

94
00:05:02,000 --> 00:05:03,000
All right, let's go and try.

95
00:05:07,000 --> 00:05:08,000
Top to start.

96
00:05:09,000 --> 00:05:12,000
Okay, it's open, but he's not running.

97
00:05:13,000 --> 00:05:14,000
And there is a reason for that.

98
00:05:15,000 --> 00:05:16,000
That is me.

99
00:05:16,000 --> 00:05:22,000
Because we need to find our game manager and drag player to the field over here.

100
00:05:22,000 --> 00:05:23,000
Let's try again.

101
00:05:25,000 --> 00:05:26,000
Stop the start.

102
00:05:26,000 --> 00:05:26,000
Boom!

103
00:05:26,000 --> 00:05:27,000
Run it.

104
00:05:27,000 --> 00:05:29,000
Well, we're done here.

105
00:05:29,000 --> 00:05:30,000
Let's go to next video.

