WEBVTT

00:00.170 --> 00:00.590
Hello guys.

00:00.590 --> 00:01.610
Welcome to the video.

00:01.610 --> 00:03.290
In this one we're going to do cleanup.

00:03.290 --> 00:06.200
And also we need to do a couple of things that I forgot to do.

00:06.200 --> 00:07.670
Nothing much, nothing special.

00:07.670 --> 00:16.400
One of them is I forgot to put on select script on other buttons such as uh, settings button and level

00:16.400 --> 00:17.180
selection.

00:17.180 --> 00:18.500
So this is what we need to do.

00:18.500 --> 00:23.390
Let's go to scripts UI and we have this update last selected.

00:26.240 --> 00:28.040
So I think we can take.

00:28.830 --> 00:32.130
A select back, back back.

00:32.130 --> 00:34.860
Maybe a sliders as well.

00:35.460 --> 00:36.450
Should be those sliders.

00:36.450 --> 00:37.800
Let's do sliders as well.

00:37.800 --> 00:43.290
So sliders back button on skin selection and select button on skin selection.

00:43.650 --> 00:45.900
Also back button on level selection.

00:45.900 --> 00:49.470
And let's just drag this update last selected like that.

00:49.470 --> 00:50.970
This is supposed to work.

00:51.360 --> 00:53.310
Um, there is also a level button.

00:53.310 --> 00:57.510
I'm not sure if we need to put it on a level button, but wait, let me find my gamepad.

00:57.510 --> 00:58.560
I want to test this.

01:00.480 --> 01:00.900
All right.

01:00.900 --> 01:04.920
So I'm going to go to prefab uh UI level button.

01:05.400 --> 01:07.710
Let's add here.

01:08.560 --> 01:12.100
UI update last selected.

01:12.100 --> 01:12.940
Okay.

01:13.420 --> 01:14.620
Now this is supposed to work.

01:14.620 --> 01:16.090
I'm going to go to play mode.

01:18.080 --> 01:20.870
New game normal select.

01:20.870 --> 01:23.810
There are levels so third one is selected.

01:23.810 --> 01:28.520
I'm going to click my mouse and level was deselected I mean button.

01:28.520 --> 01:31.460
Then I'm going to use my navigation on a gamepad again.

01:31.460 --> 01:36.200
And we have selected button okay I think it's worth to keep it.

01:36.200 --> 01:41.360
So that's one thing I forgot to do to put the scripts on other buttons in the UI.

01:42.700 --> 01:45.850
If you want to add this to in game, you can do that as well.

01:45.850 --> 01:51.790
Just take resume button and menu button and add component of update last selected.

01:51.790 --> 01:54.010
Oh no no no don't do that because.

01:56.110 --> 01:58.390
Because it doesn't have main menu.

01:58.390 --> 01:58.960
Right?

01:58.960 --> 02:00.520
But what happens if we do it?

02:00.550 --> 02:02.770
What happens if we click mouse in the game?

02:02.770 --> 02:04.390
Let me check that.

02:05.870 --> 02:08.420
I'm sorry, I forgot about this one.

02:08.420 --> 02:10.730
There were so many things to do in the last video.

02:11.580 --> 02:12.150
Level two.

02:12.150 --> 02:13.980
Okay, I'm going to press escape.

02:13.980 --> 02:15.120
I can click buttons.

02:15.120 --> 02:16.260
I'm going to use my mouse.

02:16.260 --> 02:20.940
It is deselected and now I cannot select anything again okay.

02:20.940 --> 02:22.410
So that's the problem.

02:24.050 --> 02:25.730
Now let's quickly fix it.

02:25.880 --> 02:27.770
I'm going to go to scene level one.

02:29.070 --> 02:30.030
UI in game.

02:30.030 --> 02:31.590
Let's open the script.

02:33.690 --> 02:37.950
And over here we just need a method that would update current selected button.

02:37.950 --> 02:40.410
And we have this on the main menu.

02:40.860 --> 02:43.380
We have a method like that just this one.

02:43.380 --> 02:45.510
So I'm going to copy this method.

02:45.510 --> 02:48.210
Let's go to UI in game I want to do close.

02:48.210 --> 02:52.800
All by this I'm going to paste this method somewhere below update.

02:53.490 --> 02:59.340
And instead of last selected, let's use first selected because there is only two buttons in the pose

02:59.340 --> 03:01.560
UI, so it's okay I guess.

03:01.560 --> 03:04.710
Then we need to go here and do player input.

03:05.630 --> 03:10.880
UI navigation performed plus SQL CX update.

03:11.610 --> 03:13.020
Update selected.

03:14.080 --> 03:15.550
Now let's duplicate this.

03:15.550 --> 03:18.550
Move this below and do minus.

03:20.090 --> 03:20.810
All right.

03:20.810 --> 03:22.250
This is super good.

03:22.250 --> 03:22.880
I like it.

03:22.880 --> 03:24.590
Now let's go and try this.

03:26.850 --> 03:28.380
I'm going to go to play mode.

03:28.410 --> 03:29.820
I'll use my keyboard.

03:30.710 --> 03:35.870
Escape can click the buttons using my mouse cannot click the buttons.

03:35.870 --> 03:41.180
Now I'm going to click buttons again on the keyboard and I can select something with a keyboard.

03:41.180 --> 03:41.570
Okay.

03:41.570 --> 03:43.250
So you can switch between devices.

03:43.250 --> 03:44.540
Works good.

03:44.570 --> 03:46.610
Now let's go ahead.

03:47.410 --> 03:51.850
Clear it and let's go to Asset scene main menu.

03:51.850 --> 03:53.890
And there is something else I forgot to do.

03:54.040 --> 03:56.740
As of now, if we go to new game.

03:57.460 --> 03:59.980
And we are choosing the difficulty.

03:59.980 --> 04:01.450
This showing the difficulty.

04:01.450 --> 04:04.600
But if you use your keyboard it does not show the difficulty.

04:04.600 --> 04:06.250
So we need to fix that.

04:06.250 --> 04:07.870
We need to go to canvas.

04:08.170 --> 04:10.390
Let's find difficulty buttons.

04:11.660 --> 04:12.890
There they are.

04:13.220 --> 04:14.930
And we need to add.

04:15.610 --> 04:21.910
I unselect, I select handler and I deselect handler.

04:21.910 --> 04:24.760
Let's implement this interface.

04:26.160 --> 04:28.800
Or deselect and for select.

04:30.090 --> 04:30.510
All right.

04:30.510 --> 04:31.530
This is good.

04:31.620 --> 04:35.010
Now they placed in a weird order, but it's okay.

04:35.010 --> 04:39.210
So when we deselect, we just need to make text empty.

04:39.360 --> 04:43.980
And when we select, we need to give it a description like that.

04:44.530 --> 04:44.980
Okay.

04:44.980 --> 04:46.540
How could we arrange it better?

04:47.700 --> 04:48.960
Now let's take this.

04:51.190 --> 04:54.040
And place it over here like that.

04:55.160 --> 04:58.340
And pointer enter and pointer exit on select on deselect.

04:58.370 --> 04:59.480
Okay, good.

05:01.070 --> 05:02.780
And this is supposed to help it.

05:02.780 --> 05:04.280
I'm going to double check this.

05:06.370 --> 05:07.180
New game.

05:07.180 --> 05:07.780
Yeah.

05:08.880 --> 05:09.570
Okay.

05:10.930 --> 05:13.120
Nice works with the keyboard and mouse.

05:13.120 --> 05:18.010
Something else there we have this functionality on the main menu.

05:20.200 --> 05:23.050
I'm not the main menu on skin selection.

05:23.050 --> 05:23.890
I'm sorry.

05:24.340 --> 05:25.810
Over here.

05:26.290 --> 05:28.840
And we do not unsubscribe from this.

05:28.870 --> 05:31.480
It's always better to unsubscribe from the event.

05:31.480 --> 05:35.740
So let's make a method for this so we can unsubscribe from the event.

05:35.920 --> 05:37.900
I'm going to do private void.

05:38.920 --> 05:40.660
Switch skin.

05:40.660 --> 05:49.090
With, um, navigation like that, we need to pass input action callback context CTCs.

05:49.090 --> 05:53.800
And inside we're going to just do this functionality.

05:53.800 --> 05:57.070
So I'm going to cut it out and paste it in here.

05:57.840 --> 06:03.360
And then instead of curly brackets, we're going to do switch screen with navigation.

06:03.360 --> 06:06.030
And we're going to pass it ctcss just like that.

06:06.060 --> 06:12.030
Now let's duplicate this, move this below and let's do minus over here.

06:13.360 --> 06:15.520
So this is just a bit of a cleanup that.

06:16.510 --> 06:18.370
It needs to be done right.

06:18.370 --> 06:19.780
This is the end result.

06:19.810 --> 06:21.550
Take a look, write it down.

06:21.550 --> 06:26.170
And I think that's all what came to my mind regarding the clean up.

06:26.170 --> 06:27.700
I don't remember anything else.

06:27.700 --> 06:29.830
If something comes up, I'll let you know.

06:29.830 --> 06:31.600
Maybe I can update the video later.

06:31.600 --> 06:33.220
As of now, this is pretty good.

06:33.220 --> 06:35.500
I think we are ready to jump to the next section.

06:35.500 --> 06:40.000
We did a lot of good work here and it took not that much of a time, right?

06:40.710 --> 06:41.430
Yeah.

06:41.430 --> 06:42.390
All right.

06:42.390 --> 06:44.400
I'm going to drop this project into archive.

06:44.400 --> 06:46.500
I'm going to give it to you and I'll.

06:46.530 --> 06:46.710
Oh.

06:46.710 --> 06:47.400
Hey, guys.

06:47.400 --> 06:51.570
Sorry, I forgot to show you something else here on this table over here.

06:51.570 --> 06:58.770
We need to do on disable, and we need to do default input disable and default input.

06:58.830 --> 07:05.070
Uh, UI navigate performed SQL syntax update selected.

07:05.950 --> 07:08.860
Yeah, I guess now that's it.

07:08.890 --> 07:09.520
All right.

07:09.520 --> 07:10.270
See you.
