Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,050 --> 00:00:02,450
In this video, we're going to design our health UI.
2
00:00:02,450 --> 00:00:07,250
And to do that we're going to use a free asset pack by Kenny, which has a CC0 license, which again
3
00:00:07,250 --> 00:00:09,560
means you can do whatever you want with it, pretty much.
4
00:00:09,560 --> 00:00:11,840
But we're not going to use all of these different things.
5
00:00:11,840 --> 00:00:15,740
So I made a repack, which only has the assets we're going to use to avoid confusion.
6
00:00:15,740 --> 00:00:18,800
So please make sure to download that from the resources link.
7
00:00:18,800 --> 00:00:22,160
After you've downloaded it you should have this health UI zip.
8
00:00:22,160 --> 00:00:24,140
Again, just make sure to unzip it.
9
00:00:24,140 --> 00:00:25,790
This UI might be different for you.
10
00:00:26,380 --> 00:00:28,930
And in here we then have the license, right?
11
00:00:28,930 --> 00:00:30,400
Is the CC0 license.
12
00:00:30,430 --> 00:00:32,350
It tells you what you can do with it.
13
00:00:32,770 --> 00:00:35,950
In the textures folder we just have these three different things.
14
00:00:35,950 --> 00:00:38,290
So we have the glass panel which is going to be the background.
15
00:00:38,290 --> 00:00:40,870
We have the square green which we use.
16
00:00:40,870 --> 00:00:46,960
If we do have the health and we have this shadow square, if the health is depleted back in Unreal Engine,
17
00:00:46,960 --> 00:00:51,460
go to the content drawer, go to content and we can go to paper assets.
18
00:00:51,460 --> 00:00:54,910
These are technically not paper assets, but I still like to keep them in here.
19
00:00:54,910 --> 00:00:58,690
And we can just create a new folder and call it UI.
20
00:00:59,230 --> 00:01:02,860
And here we then just want to drag these three textures in.
21
00:01:03,340 --> 00:01:06,040
Just select these three and drag them into Unreal Engine.
22
00:01:06,700 --> 00:01:07,630
Like this.
23
00:01:08,460 --> 00:01:12,570
And again, if you have problems with dragging, you can use the import button instead.
24
00:01:13,050 --> 00:01:19,230
Since these are UI elements, we do not want to apply paper 2D texture settings because this is for
25
00:01:19,230 --> 00:01:19,620
pixel art.
26
00:01:19,650 --> 00:01:23,910
This is for paper 2D assets, but we do want to change some other settings.
27
00:01:23,910 --> 00:01:27,510
So we can just select all of them, hold shift and right click.
28
00:01:27,510 --> 00:01:32,760
And again asset actions edit selection in Property Matrix.
29
00:01:32,760 --> 00:01:36,810
And there's just a couple of settings we want to set up here for UI elements.
30
00:01:36,810 --> 00:01:38,550
And here make sure to select all of them.
31
00:01:38,550 --> 00:01:43,440
Control A and we want to look on the right side for compression.
32
00:01:44,980 --> 00:01:46,060
Compression.
33
00:01:46,710 --> 00:01:51,750
And here we have the compression settings we want to set this to.
34
00:01:52,410 --> 00:01:56,220
User interface 2D because these are UI elements.
35
00:01:58,750 --> 00:02:01,180
And we also want to set the texture group.
36
00:02:02,060 --> 00:02:03,890
The level of detail texture group.
37
00:02:03,890 --> 00:02:07,580
And we want to set this to user interface UI.
38
00:02:07,580 --> 00:02:11,180
And those are the two basic settings you need for UI elements.
39
00:02:11,180 --> 00:02:12,440
And then just save.
40
00:02:12,440 --> 00:02:15,080
And we can now safely use these.
41
00:02:15,080 --> 00:02:19,100
And now we can just close all of these things to the right and close these.
42
00:02:19,100 --> 00:02:21,740
And here we can see these look a little bit different now.
43
00:02:21,740 --> 00:02:22,070
Right.
44
00:02:22,070 --> 00:02:23,150
So these look fine.
45
00:02:24,100 --> 00:02:25,660
And we can use them now.
46
00:02:26,330 --> 00:02:28,940
Now let's create a blueprint for the health component.
47
00:02:28,940 --> 00:02:33,740
So in the content drawer go to Content Widgets right click.
48
00:02:33,740 --> 00:02:38,060
And in this case we don't have a direct parent and child relationship.
49
00:02:38,060 --> 00:02:41,960
But we're going to create another widget and just put it inside of here right.
50
00:02:41,960 --> 00:02:45,560
So just create a new widget right click user interface.
51
00:02:45,560 --> 00:02:47,690
And here we have a widget blueprint.
52
00:02:47,690 --> 00:02:54,650
Use the user widget and call it WB health component.
53
00:02:57,360 --> 00:02:58,530
And open it up.
54
00:02:59,940 --> 00:03:02,190
And in here, let's just look at the designer first.
55
00:03:02,190 --> 00:03:04,560
We're not going to worry about the actual functionality.
56
00:03:04,560 --> 00:03:05,400
This video.
57
00:03:05,400 --> 00:03:07,650
We only want to make it look nice.
58
00:03:07,650 --> 00:03:13,230
And to get started, you might think that we want to use a canvas again, which would be an option.
59
00:03:13,230 --> 00:03:18,240
However, you actually want to keep canvas panels to a minimum for the overall UI.
60
00:03:18,240 --> 00:03:23,760
It made sense, but canvases are actually surprisingly heavy to render because they all cause a new
61
00:03:23,760 --> 00:03:24,480
draw call.
62
00:03:24,480 --> 00:03:26,100
And now we just get into optimization.
63
00:03:26,100 --> 00:03:30,090
I don't want to go into too much detail here, but you want to keep canvases to a minimal.
64
00:03:30,090 --> 00:03:34,440
It's not the worst thing in the world, but if we have another option, we want to use something else.
65
00:03:34,440 --> 00:03:38,010
And in this case, let's just get rid of the canvas panel, delete it.
66
00:03:38,010 --> 00:03:41,400
And in this case, the best thing actually is a border.
67
00:03:41,730 --> 00:03:43,410
So we can just drag this in here.
68
00:03:44,360 --> 00:03:46,280
And on first glance it looks similar.
69
00:03:46,280 --> 00:03:52,040
But a border basically is just a box which can have some content inside of it.
70
00:03:52,040 --> 00:03:56,720
And this is really good for buttons and things like that, or also for this kind of border we want to
71
00:03:56,720 --> 00:03:58,550
have around the health bar.
72
00:03:59,130 --> 00:04:00,930
And now we just have this white color.
73
00:04:00,930 --> 00:04:05,100
But for this brush on the right side, we actually want to use our image.
74
00:04:05,100 --> 00:04:08,700
So here we can go in here and we can look for glass.
75
00:04:08,700 --> 00:04:09,720
Glass.
76
00:04:10,470 --> 00:04:12,270
Panel, I think.
77
00:04:12,270 --> 00:04:12,600
Yes.
78
00:04:12,600 --> 00:04:15,480
So the textured glass panel and we can use this here.
79
00:04:15,480 --> 00:04:18,630
And by default it looks very bad because it's being stretched.
80
00:04:18,630 --> 00:04:25,230
We actually want to cut it up and kind of use these different parts on it instead of stretching it.
81
00:04:25,620 --> 00:04:27,210
And this is actually very easy.
82
00:04:27,240 --> 00:04:32,400
We just have to click here on draw S and instead of image draw S box.
83
00:04:33,290 --> 00:04:35,900
And we then also have to set a margin.
84
00:04:35,900 --> 00:04:38,870
So for the margin we can just set maybe 0.1.
85
00:04:39,140 --> 00:04:40,670
And let's zoom in a little bit.
86
00:04:40,670 --> 00:04:42,230
And you can see it's a lot clearer now.
87
00:04:42,230 --> 00:04:42,470
Right.
88
00:04:42,470 --> 00:04:45,620
So it kind of cuts up this image into multiple parts.
89
00:04:45,620 --> 00:04:50,900
And then just reuses these to create this nice box that looks very high definition.
90
00:04:51,170 --> 00:04:53,600
And yeah I think 0.1 is about right.
91
00:04:53,600 --> 00:04:56,480
Let's see what happens if we do 0.5 for example.
92
00:04:56,480 --> 00:04:57,710
And not much changes.
93
00:04:57,710 --> 00:04:59,330
But yeah 0.1 is enough.
94
00:04:59,330 --> 00:05:00,980
So we get the border here.
95
00:05:01,810 --> 00:05:05,230
And now we want to add text and images in here.
96
00:05:05,260 --> 00:05:10,000
One problem with the border, though, is that let's say we want to add text like this.
97
00:05:10,000 --> 00:05:12,850
This is fine, but we also want to add an image.
98
00:05:12,850 --> 00:05:17,200
We actually can't because the border can only have a single child.
99
00:05:17,850 --> 00:05:21,450
And with these elements, there's a lot of restrictions like this where you can only have a certain
100
00:05:21,450 --> 00:05:27,480
amount of children and only certain things fit into other things, and we cannot put an image and a
101
00:05:27,480 --> 00:05:29,670
text inside of the border at the same time.
102
00:05:29,670 --> 00:05:31,230
So we have to use something else.
103
00:05:31,590 --> 00:05:33,450
Let's just delete the text for now.
104
00:05:33,450 --> 00:05:36,720
And here we can look for panel.
105
00:05:36,900 --> 00:05:38,910
And in here we have a lot of different options.
106
00:05:38,910 --> 00:05:45,270
And panels kind of are like a parent where we can put multiple things inside in most cases.
107
00:05:45,270 --> 00:05:50,370
In this case, we want to have one thing at the top and then have multiple images at the bottom.
108
00:05:50,370 --> 00:05:55,260
So in this case, a vertical box is actually what makes the most sense, right.
109
00:05:55,260 --> 00:05:58,560
So this lets us put a thing on top and a thing below it.
110
00:05:58,560 --> 00:06:00,240
So we can just put this in here.
111
00:06:00,240 --> 00:06:01,950
Nothing really changes so far.
112
00:06:01,950 --> 00:06:07,920
But what we can do now is we can get the text, put it in the vertical box, and we can get the image
113
00:06:07,920 --> 00:06:10,020
and put it in the vertical box as well.
114
00:06:10,020 --> 00:06:10,320
Right.
115
00:06:10,320 --> 00:06:13,200
And now you can see one thing is above the other.
116
00:06:13,200 --> 00:06:14,580
And this still looks very bad.
117
00:06:14,580 --> 00:06:16,260
We still have to work on this.
118
00:06:16,260 --> 00:06:18,780
But this is the basic setup we need.
119
00:06:19,320 --> 00:06:20,910
For now let's just select the image.
120
00:06:20,910 --> 00:06:25,440
And instead of the brush of nothing, we want to look for our square.
121
00:06:25,440 --> 00:06:27,210
I think it's called green square.
122
00:06:27,210 --> 00:06:27,540
Yeah.
123
00:06:27,570 --> 00:06:30,300
Square green the texture selected.
124
00:06:30,300 --> 00:06:32,250
And this is the icon we want to use.
125
00:06:32,250 --> 00:06:33,600
But again it is being stretched.
126
00:06:33,600 --> 00:06:35,370
This is not ideal yet.
127
00:06:35,370 --> 00:06:41,130
The truth is that the way things are being displayed here doesn't necessarily mean it's going to look
128
00:06:41,130 --> 00:06:43,170
in the game the same way.
129
00:06:43,170 --> 00:06:46,500
We actually have an option here on the right side which says fill screen.
130
00:06:46,500 --> 00:06:50,310
So this is just simulating if we fill the entire screen with this widget.
131
00:06:50,310 --> 00:06:53,520
So actually we can just go here and click on desired.
132
00:06:53,520 --> 00:06:56,040
And you can see that it becomes much smaller.
133
00:06:56,040 --> 00:07:02,940
So in this case desired just shows that the biggest part will kind of understand what is inside of it
134
00:07:02,940 --> 00:07:06,060
and only uses up as little space as is necessary.
135
00:07:06,060 --> 00:07:10,830
However, in your game, this again will depend on where you put this widget in.
136
00:07:10,830 --> 00:07:12,420
Let's first update the text.
137
00:07:12,420 --> 00:07:15,870
So for the text we just want to call it health.
138
00:07:17,250 --> 00:07:20,610
And to make it easier to see, just give it a little outline.
139
00:07:20,610 --> 00:07:25,770
So under the font outline settings just give it a one pixel outline.
140
00:07:25,770 --> 00:07:27,900
And now it's just easier to read.
141
00:07:28,260 --> 00:07:33,510
We also want to have a little bit more of a gap between the image, the text, and the outside border
142
00:07:33,510 --> 00:07:34,410
of the box.
143
00:07:34,410 --> 00:07:37,530
And to do that, we can just go to the vertical box.
144
00:07:37,530 --> 00:07:40,260
And at the top we have the padding settings here.
145
00:07:40,680 --> 00:07:42,090
And here we can just open this up.
146
00:07:42,090 --> 00:07:44,760
We have left top right bottom.
147
00:07:44,760 --> 00:07:51,540
And I just want to use 16 for left and right and ten for top and bottom.
148
00:07:51,540 --> 00:07:57,540
And if I hit enter you can see that we now have this nice padding here around our content.
149
00:07:57,540 --> 00:08:03,270
And if you are familiar with the web design and CSS, this is a little bit of a similar concept.
150
00:08:03,540 --> 00:08:05,820
Next we want to make this square image smaller.
151
00:08:05,820 --> 00:08:07,590
So we can just select it.
152
00:08:07,590 --> 00:08:12,990
And you can see now horizontal alignment and vertical alignment are both being stretched.
153
00:08:12,990 --> 00:08:16,980
So for the horizontal alignment we can just select this left align.
154
00:08:16,980 --> 00:08:20,310
And you can see that we don't have this crazy stretching anymore.
155
00:08:20,310 --> 00:08:22,320
But the size is still a bit off.
156
00:08:22,320 --> 00:08:24,720
It is not the correct size of the texture.
157
00:08:24,720 --> 00:08:31,950
If we open up the texture in the content drawer, content, paper, assets UI and this square green,
158
00:08:31,950 --> 00:08:37,289
if we just hover, you can see it says dimension 19 by 26.
159
00:08:37,289 --> 00:08:40,919
So this is the actual size and we want to apply this as well.
160
00:08:40,919 --> 00:08:46,470
So in here if we go here to the image we can set the image size.
161
00:08:46,710 --> 00:08:49,170
There is an option here right image size.
162
00:08:49,170 --> 00:08:51,480
And here we can just put in the value we just read.
163
00:08:51,480 --> 00:08:51,810
Right.
164
00:08:51,810 --> 00:08:55,170
So here this um 19 by 26.
165
00:08:56,930 --> 00:08:59,060
So here X is 19.
166
00:08:59,980 --> 00:09:02,170
And why is 26?
167
00:09:02,560 --> 00:09:04,780
And this is the correct image size now.
168
00:09:04,780 --> 00:09:06,070
So we don't have any stretching.
169
00:09:06,070 --> 00:09:08,350
This is how it is being drawn in the texture.
170
00:09:09,330 --> 00:09:10,950
But now we still have a problem.
171
00:09:10,950 --> 00:09:14,910
We cannot have multiple of these health images next to each other, right?
172
00:09:14,910 --> 00:09:19,110
So even if I go here and duplicate, it is going to be at the bottom.
173
00:09:19,110 --> 00:09:21,510
But these we do want to have next to each other.
174
00:09:21,510 --> 00:09:23,640
So this one I can just delete again.
175
00:09:23,640 --> 00:09:27,030
And for this we want to use a horizontal box.
176
00:09:27,030 --> 00:09:30,750
So here in the panel we can look for the horizontal box.
177
00:09:30,750 --> 00:09:33,660
And I want to drag this in here below the health.
178
00:09:33,900 --> 00:09:36,810
And now the horizontal box by itself doesn't do anything.
179
00:09:36,810 --> 00:09:40,410
We want to grab the image and put it inside the horizontal box.
180
00:09:40,680 --> 00:09:41,070
Right.
181
00:09:41,070 --> 00:09:43,050
And now you can see it is inside of this box.
182
00:09:43,050 --> 00:09:49,440
I can just go here to the image and I can just duplicate or hit control and D right.
183
00:09:49,440 --> 00:09:54,630
So we have 3456789 ten because we have ten health.
184
00:09:54,810 --> 00:09:57,060
And now we have these ten images next to each other.
185
00:09:57,060 --> 00:10:01,470
And you can see that the border actually expanded to accommodate for the new size of the content.
186
00:10:02,270 --> 00:10:06,200
But now all of these are kind of close together, which doesn't look great.
187
00:10:06,200 --> 00:10:09,590
We actually want to have a little bit of a padding in between all of these.
188
00:10:09,590 --> 00:10:11,570
And there's multiple ways you could do this.
189
00:10:11,570 --> 00:10:14,300
There's spacers and all of these things in CSS.
190
00:10:14,300 --> 00:10:15,860
In web design, it would actually be very easy.
191
00:10:15,860 --> 00:10:18,290
And you would just have to set the gap to maybe three pixels.
192
00:10:18,290 --> 00:10:20,780
However, I believe we don't have a setting like this.
193
00:10:20,780 --> 00:10:23,690
So the way that I'm going to use is to go to the first image.
194
00:10:23,690 --> 00:10:26,030
And here we have padding and padding.
195
00:10:26,030 --> 00:10:26,570
Right.
196
00:10:26,570 --> 00:10:28,850
I just want to set this to three.
197
00:10:29,120 --> 00:10:29,570
Right.
198
00:10:29,570 --> 00:10:32,780
And now we can see we get this little nice padding here.
199
00:10:32,780 --> 00:10:34,160
And now all of the other images.
200
00:10:34,160 --> 00:10:38,240
I'm just going to delete them and use the first one control D to duplicate.
201
00:10:38,240 --> 00:10:42,470
And again just make 2345678.
202
00:10:43,060 --> 00:10:44,350
910.
203
00:10:44,350 --> 00:10:46,780
And on the last one we don't need the padding.
204
00:10:46,780 --> 00:10:48,460
So this one we can just reset to zero.
205
00:10:48,460 --> 00:10:51,280
And now we have this nice padding between all of them.
206
00:10:51,280 --> 00:10:56,290
And we did this in a very simple manner without overthinking it and having to use spacers and all of
207
00:10:56,290 --> 00:10:57,130
these things.
208
00:10:57,160 --> 00:11:00,820
Now that the look for the health UI is completed, let's add it to our HUD.
209
00:11:01,810 --> 00:11:08,470
So we can just go here and open up the content widgets, the WB HUD.
210
00:11:08,500 --> 00:11:09,370
Open it up.
211
00:11:09,370 --> 00:11:11,020
And now we can just get rid of this text.
212
00:11:11,020 --> 00:11:12,340
This was just for testing.
213
00:11:12,340 --> 00:11:13,270
Just get rid of it.
214
00:11:13,270 --> 00:11:14,170
Delete it.
215
00:11:14,170 --> 00:11:18,250
And here we can now look for the WB.
216
00:11:18,550 --> 00:11:20,380
And we can see our health component.
217
00:11:20,380 --> 00:11:25,030
So we can have one widget inside of another one which is very powerful.
218
00:11:25,030 --> 00:11:30,010
So we can just use this, put it in the canvas panel and you can't really see it.
219
00:11:30,010 --> 00:11:32,230
We actually have to go here compile and save.
220
00:11:32,590 --> 00:11:36,640
And here also compile and save so that it shows up properly.
221
00:11:37,360 --> 00:11:43,480
And you can see that something is off the health text and the images look fine, but the border looks
222
00:11:43,480 --> 00:11:44,560
really weird.
223
00:11:44,590 --> 00:11:49,120
And this is because the canvas applies kind of its own rules to all of the children.
224
00:11:49,120 --> 00:11:49,600
Right.
225
00:11:49,600 --> 00:11:51,460
So you can see this box here.
226
00:11:51,460 --> 00:11:53,800
We can just drag this box and make it matching.
227
00:11:53,800 --> 00:11:54,310
Right.
228
00:11:54,310 --> 00:11:55,390
And this is fine.
229
00:11:55,390 --> 00:11:58,990
But there is actually a better option built into the canvas.
230
00:11:58,990 --> 00:12:04,870
And we can simply look for size to content and click here.
231
00:12:04,870 --> 00:12:09,310
And now we have it kind of the same size as here with the desired right.
232
00:12:09,310 --> 00:12:14,740
Because now it's going to respect the content and it's going to change the size depending on how much
233
00:12:14,740 --> 00:12:16,660
health we have in here, how long the text is.
234
00:12:16,660 --> 00:12:20,770
And this is usually the best option if you're adding something to a canvas.
235
00:12:20,980 --> 00:12:23,710
In this case, anchoring to the top left is fine, right?
236
00:12:23,710 --> 00:12:26,020
We want the health to always be on the top left.
237
00:12:26,020 --> 00:12:31,090
This is good, but we want to have a little bit of padding because now we're just right in the corner,
238
00:12:31,090 --> 00:12:35,650
which isn't great because again, the canvas panel slot gives us a lot of options here.
239
00:12:35,650 --> 00:12:38,110
We can just go position X 50.
240
00:12:38,720 --> 00:12:41,240
And position y also go 50.
241
00:12:41,240 --> 00:12:44,180
And now we have this nice padding here to the corner.
242
00:12:44,180 --> 00:12:45,230
And this is it.
243
00:12:45,230 --> 00:12:51,650
Let's check it out inside of the game I start the game and you can see the health at the top left right.
244
00:12:51,650 --> 00:12:52,700
So this is working.
245
00:12:52,700 --> 00:12:53,870
The health is being displayed.
246
00:12:53,870 --> 00:12:58,190
But you can see that if I take damage we aren't really updating the health yet.
247
00:12:58,190 --> 00:13:00,950
We still have the ten health bars even though we are taking damage.
248
00:13:00,950 --> 00:13:03,470
So this is what we're going to do in the next video.
22335
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.