Hello, guys.
In this video, we're going to adjust our start screen and make this top to start button actually work.
All right.
Let's go to play mode and see what we have right now.
So at the moment, my platform is bound and my player is somewhere below, which is not cool.
What we need to do here is to switch on the player.
And then I want to add an extra platform here to make kind of a base platform that will be always there
no matter what you spawn.
Next, let's unpack prefab of the level part and completely.
Then I'm going to delete start point and end point and limiter.
I don't need it and I can remove script from here.
I don't need it as well.
I want to find my level part.
Zoom it out by bit and just take this platform and move it to the left and make it wider like this.
And maybe put it a bit higher here.
Then I want to take player and move here as well.
Just like this.
Maybe make the platform longer.
So now, no matter what is found with the level generator, the player is going to stand on the ground
and it's going to be fine.
Okay, You see that?
Cool.
Now, let's take little generator.
If you don't have your platforms here, put it there.
I'm going to draw second part and third part.
I have only two good level bars for now.
Now let's see how it is so they could spawn a bit to the right and we can fix that by changing next
position part and increasing the X.
But I don't want to confuse anyone, so let's just take the platform and move it to the left like so,
and move player to the left as well.
Like so then let's see this.
This is better.
Now let's make this stop to start button functional.
First of all, we need to unlock the player.
And I want to do that by going to game manager.
First, I want to get access to the player.
So let's do this public player player.
Then let's create a function that's going to do one line of code, public void and lock player, right?
And here it's going to return player, dot player unlocked.
Oh, I guess it's a private boolean.
So let's go and fix that.
Let's go to player script, find player unlocked, make it public.
But I want to do.
Hide in the inspector.
Hide in, Inspector.
All right.
Now, before, if you remember, we did unlock the player with the button.
Now I want to remove that ability.
Let's go to input.
Check.
Here.
And we can delete this function or we can comment it.
I will just comment out.
So.
Okay, so it's not functional anymore.
Good.
Now let's go to game manager.
And because Player Unlocked is public, now we can get access to that player.
Unlocked equals to true.
Good enough.
Now let's go to UI main and create a function.
Public void.
Start game and we're going to return game manager dot instance dot unlock layer.
Let's go back to canvas.
I want to find this top to start button.
Click plus and drag canvas.
Then find switch two.
And we're going to switch to ingame UI.
That's the first one.
And we can add one more.
It's going to be again, canvas and then UI.
Start game.
All right.
What we could do here is just to drag function from a game manager.
This also would be fine.
Game manager and log player.
That's okay, but I want to keep it organized.
Plus, you never know what kind of functionality you want to add to these function.
Let's do this.
All right.
Sorry I did this while I was talking.
Make sure you have the same canvas.
Switch menu to canvas start game.
Good.
So what I was saying is you never know when you're going to change the functionality of your function.
Maybe I want to add some stuff here that is relatable to UI only, and then I would have to create a
function, but now I have a function that I can edit if I need to.
So it's kind of a good practice to keep everything at one place.
So later, for example, imagine you open this game after a month or so, and if you go to you, I mean
you clearly can see your switch menu too.
And you choose a menu and you start game by unlocking the player with a function.
But if this would not be here, for example, if we would have just drag function from game manager,
it might be difficult to find how you even unlock in the player.
All right, let's go and try.
Top to start.
Okay, it's open, but he's not running.
And there is a reason for that.
That is me.
Because we need to find our game manager and drag player to the field over here.
Let's try again.
Stop the start.
Boom!
Run it.
Well, we're done here.
Let's go to next video.