1
00:00:03,120 --> 00:00:07,140
Hello again in this lecture will be playing around with unity, learning the interface and creating

2
00:00:07,140 --> 00:00:12,240
a silly little pretend platformer that we will then go and take a screenshot and post on the Game Dev

3
00:00:12,240 --> 00:00:13,350
TV forum.

4
00:00:13,350 --> 00:00:14,940
So let's get started.

5
00:00:15,150 --> 00:00:20,130
Let's start this process by making ourselves a new project, Open Up Unity Hub, and then find the new

6
00:00:20,130 --> 00:00:20,730
button.

7
00:00:20,730 --> 00:00:24,750
If you've got more than one version, you can click on the little arrow to the right of news, select

8
00:00:24,750 --> 00:00:29,730
the version that you want, click on that, and then click on 2D to say it's a 2D type of project.

9
00:00:29,730 --> 00:00:33,390
Name your project I'm going to call mine experimenting because we're just goofing around.

10
00:00:33,390 --> 00:00:38,040
And then of course, choose a location on your harddrive where it will save and then click the create

11
00:00:38,040 --> 00:00:39,420
button and we're good to go.

12
00:00:39,630 --> 00:00:40,940
This will take a few moments.

13
00:00:40,950 --> 00:00:44,340
I'll pause my video and I'll be back when mine has loaded and ready to go.

14
00:00:44,370 --> 00:00:45,990
Okay, here we are in unity.

15
00:00:45,990 --> 00:00:51,390
If your window layout doesn't look like this, you can jump up to window layouts and click on default

16
00:00:51,390 --> 00:00:53,130
and it should return to this default layout.

17
00:00:53,130 --> 00:00:54,930
You can move your windows around a whole bunch.

18
00:00:54,930 --> 00:00:56,850
You can move the tabs around where you want to.

19
00:00:56,850 --> 00:00:59,280
So grab a console tab and move it somewhere else.

20
00:00:59,280 --> 00:01:00,600
I'll pop it back there if I can.

21
00:01:00,600 --> 00:01:00,810
Yep.

22
00:01:00,810 --> 00:01:01,320
There we go.

23
00:01:01,320 --> 00:01:05,400
So you can move things around as you like, as is the case with most software nowadays.

24
00:01:05,400 --> 00:01:07,050
Over on the left we have the hierarchy.

25
00:01:07,050 --> 00:01:12,240
If I click the little opening closing thing here, you can see in the hierarchy we've got sample scene.

26
00:01:12,240 --> 00:01:16,350
That's the name of our project at the moment or our level that's in our project.

27
00:01:16,350 --> 00:01:19,710
And I have a main camera that's the only game object I have.

28
00:01:19,710 --> 00:01:25,110
If I click on main camera, you can see over on the right hand side, the inspector has lit up with

29
00:01:25,110 --> 00:01:29,580
a whole bunch of information and that information is telling us all about what's going on with the camera

30
00:01:29,580 --> 00:01:31,530
and we can change particular things there.

31
00:01:31,530 --> 00:01:33,210
So we'll come back to the inspector in a moment.

32
00:01:33,210 --> 00:01:35,700
I want to show you a little bit more about the layout of unity.

33
00:01:35,700 --> 00:01:38,250
Down in the bottom left, we have the project tab.

34
00:01:38,250 --> 00:01:40,170
In here, we have the assets directory.

35
00:01:40,170 --> 00:01:43,740
This is where all the things that are saved on your hard drive will live.

36
00:01:43,740 --> 00:01:48,030
So at the moment we just have the scenes folder in here we have our sample scene.

37
00:01:48,060 --> 00:01:51,450
This is our scene or level, depending upon what you'd like to call it.

38
00:01:51,450 --> 00:01:56,160
And you can see down here it's a dot unity file that's saved on our hard drive.

39
00:01:56,160 --> 00:02:01,110
Anything we change within our scene will be updated within our unity file.

40
00:02:01,110 --> 00:02:04,050
So our scene is in our scene window.

41
00:02:04,050 --> 00:02:05,790
You see up here, we've got a tab that says scene.

42
00:02:05,790 --> 00:02:08,699
That's where all of our game objects will be displayed.

43
00:02:08,699 --> 00:02:13,800
Next to the scene tab, we have the game tab or the game window that is showing us what we're seeing

44
00:02:13,800 --> 00:02:15,240
through our camera at the moment.

45
00:02:15,240 --> 00:02:17,070
At the moment, there's not much of a game in there.

46
00:02:17,070 --> 00:02:19,800
And then we also have the asset store that's changed a little bit.

47
00:02:19,800 --> 00:02:24,180
It used to be you could navigate everything in here, but now when you click, this will open up in

48
00:02:24,180 --> 00:02:28,200
a browser and take you to find a whole bunch of cool assets which will play around with that a little

49
00:02:28,230 --> 00:02:29,760
bit later on in the course.

50
00:02:29,760 --> 00:02:33,000
For now, we're going to add a game object into our hierarchy.

51
00:02:33,000 --> 00:02:35,820
So find the hierarchy in this big open space in here.

52
00:02:35,820 --> 00:02:39,330
Right click to the object and then Sprite.

53
00:02:39,330 --> 00:02:42,480
I'm going to add a more at a square in there.

54
00:02:42,480 --> 00:02:46,890
You can see it's added a square in our hierarchy and we have an opportunity to rename it.

55
00:02:46,890 --> 00:02:48,120
I'll just leave it as square.

56
00:02:48,120 --> 00:02:52,860
And in general, I'll be pretty messy in the hierarchy in this lecture because I don't want to take

57
00:02:52,860 --> 00:02:56,070
you through the organizing the hierarchy because that's a little bit drier.

58
00:02:56,070 --> 00:02:57,210
We'll do that later on.

59
00:02:57,210 --> 00:03:01,380
For now, it is sort of chuck things in there and not worry so much about whether they're named properly

60
00:03:01,380 --> 00:03:02,910
or nice and neat and tidy.

61
00:03:02,910 --> 00:03:07,620
So if I click on square in the hierarchy, it'll highlight over in the inspector what's going on with

62
00:03:07,620 --> 00:03:08,820
the details of the square.

63
00:03:08,820 --> 00:03:13,650
And it will also give me a indication that I've selected this within my scene.

64
00:03:13,740 --> 00:03:16,230
I'm using my mouse wheel to scroll in and out.

65
00:03:16,230 --> 00:03:20,880
You can also hold down alt and right mouse button and move to the left or to the right.

66
00:03:20,880 --> 00:03:22,980
That is another way to zoom in and out.

67
00:03:22,980 --> 00:03:28,140
And if I click and hold down the middle mouse button, I can move around in my world or pan around.

68
00:03:28,140 --> 00:03:28,980
As the case might be.

69
00:03:28,980 --> 00:03:33,210
I can also come up here into the top left and click on the little hand, which is the pan tool.

70
00:03:33,210 --> 00:03:36,120
And then with my left mouse button, I can move around in the scene.

71
00:03:36,120 --> 00:03:37,770
Now I've got my object in here.

72
00:03:37,770 --> 00:03:40,460
It's right underneath the camera, which makes it a little bit misleading.

73
00:03:40,470 --> 00:03:45,090
You see, the main camera, the icon for that is right in the middle of where my square is.

74
00:03:45,090 --> 00:03:46,620
So I'm going to jump up here to my toolbar.

75
00:03:46,680 --> 00:03:50,100
And next to the hand I've got this four way arrow, which is the Move tool.

76
00:03:50,100 --> 00:03:55,590
If I click on that or I click W on the keyboard to get this particular tool, then I've got these handles

77
00:03:55,590 --> 00:04:02,250
showing up on my game object green is to the Y direction or up as we're looking and red is on the x

78
00:04:02,250 --> 00:04:03,120
axis to the right.

79
00:04:03,120 --> 00:04:07,620
So if I grab the red handle and move it right and left allows me to move my game object right and left,

80
00:04:07,620 --> 00:04:09,570
and likewise with the green up and down.

81
00:04:09,570 --> 00:04:13,830
And also there's a little space in the middle where you can grab that and move it on both the X and

82
00:04:13,830 --> 00:04:14,040
the Y.

83
00:04:14,070 --> 00:04:18,510
So I'm going to head over to the right hand side of the screen just to draw your attention to what's

84
00:04:18,510 --> 00:04:19,230
going on over here.

85
00:04:19,230 --> 00:04:24,210
As I move it around, you can see under the position we have X and Y and those numbers are updating

86
00:04:24,210 --> 00:04:24,450
as well.

87
00:04:24,450 --> 00:04:26,760
If I move it down, then the Y goes down.

88
00:04:26,760 --> 00:04:28,980
It's in negative five point something or other.

89
00:04:28,980 --> 00:04:31,020
And up, up, up, up, it's going up.

90
00:04:31,020 --> 00:04:34,650
So I can change the position by grabbing it and moving it around this game object.

91
00:04:34,650 --> 00:04:42,000
Or I can type in a value here, say set it to zero on the x axis or I can mouse over the letter x or

92
00:04:42,000 --> 00:04:45,540
y and hit my left mouse button or hold my left mouse button down.

93
00:04:45,540 --> 00:04:46,830
That will allow me to drag it.

94
00:04:46,830 --> 00:04:48,690
We can also rotate them.

95
00:04:48,690 --> 00:04:52,460
So if I head up to my next icon in the top left, you can see the little arrows swirling around.

96
00:04:52,470 --> 00:04:57,810
I can click on that or I can click E on the keyboard and you can see we've got this outline around our

97
00:04:57,810 --> 00:04:58,170
object.

98
00:04:58,170 --> 00:05:02,310
If I grab onto the blue handle or the blue circle, hold down.

99
00:05:02,600 --> 00:05:08,390
Mouse button, I can rotate around my object, or as we've done before, I can find where that rotation

100
00:05:08,390 --> 00:05:08,540
is.

101
00:05:08,540 --> 00:05:12,380
It's on the Z or the Z axis and I can do the same sort of rotation there.

102
00:05:12,380 --> 00:05:14,480
I'll put it back to zero for rotation for the moment.

103
00:05:14,480 --> 00:05:18,230
The next button along is to scale, which corresponds to R on the keyboard.

104
00:05:18,250 --> 00:05:21,920
That allows me to grab a handle and to move it to make it bigger or smaller.

105
00:05:21,920 --> 00:05:25,610
Or if you can't quite see it here, but there's a dot in the middle that allows us to move the whole

106
00:05:25,610 --> 00:05:26,840
thing in a uniform way.

107
00:05:26,840 --> 00:05:32,960
Or of course we could scale using our sliders and our numbers over within the transform area.

108
00:05:32,960 --> 00:05:37,520
And then the last one I'll show you up here is the rect transform tool, clicking on that or clicking

109
00:05:37,550 --> 00:05:38,330
T on the keyboard.

110
00:05:38,330 --> 00:05:44,840
So Q w e r t following along on the keyboard that allows me to grab the sides or to grab the corners

111
00:05:44,840 --> 00:05:49,940
and move accordingly so I can get things exactly into the spot that I want, so I can hit W to move

112
00:05:49,940 --> 00:05:52,900
this down to the bottom of my window area.

113
00:05:52,910 --> 00:05:58,250
That's going to make things a little bit further back and then t to move that to the right, move that

114
00:05:58,250 --> 00:06:00,530
to the left, make it a little bit smaller.

115
00:06:00,530 --> 00:06:03,860
And now I've got some sort of thing that could be considered a ground.

116
00:06:03,860 --> 00:06:08,240
Now, also with the game objects here, when I click on the main camera, you can see that we've got

117
00:06:08,240 --> 00:06:10,700
Transform and then we've got camera.

118
00:06:10,700 --> 00:06:16,670
These things are components and a component is what makes it the particular type of game object that

119
00:06:16,670 --> 00:06:17,120
it is.

120
00:06:17,120 --> 00:06:20,210
This is a camera because it has a camera component.

121
00:06:20,210 --> 00:06:24,440
This is a sprite because it has a Sprite renderer component.

122
00:06:24,440 --> 00:06:25,310
And what is a Sprite?

123
00:06:25,310 --> 00:06:31,640
Well, it's a 2D graphic object that we can move around in our world that comes from a bitmap image.

124
00:06:31,640 --> 00:06:35,690
So in other words, it's an image that we turn into something that our game can understand, and we

125
00:06:35,690 --> 00:06:36,740
call it a Sprite.

126
00:06:36,740 --> 00:06:40,430
And the Sprite renderer also has some fields and some values.

127
00:06:40,430 --> 00:06:45,770
So if I click on the white color selector here, I can change the color of our sprite by moving the

128
00:06:45,770 --> 00:06:50,270
selectors on the inside of the square area and around the outside to change the color we've selected

129
00:06:50,270 --> 00:06:52,280
and then X out of that when we're done.

130
00:06:52,280 --> 00:06:59,120
So now we have changed the color through our sprite renderer to make our square a green color.

131
00:06:59,150 --> 00:07:00,920
Okay, let's go ahead and add ourselves.

132
00:07:00,920 --> 00:07:04,970
Another game object I'll give you this to is a little micro challenge to make sure that you're actually

133
00:07:04,970 --> 00:07:08,000
doing this at the same time and not just watching along like a zombie.

134
00:07:08,000 --> 00:07:11,180
So I want you to add a new Sprite into our scene.

135
00:07:11,180 --> 00:07:14,660
Let's see if you can add a circle into our scene.

136
00:07:14,660 --> 00:07:16,850
So pause the video, take a moment to do that.

137
00:07:17,600 --> 00:07:17,990
Okay.

138
00:07:17,990 --> 00:07:18,920
So let's do this together.

139
00:07:18,920 --> 00:07:25,190
If you didn't manage to figure that out, right click in the hierarchy, 2D Object Sprites and circle.

140
00:07:25,190 --> 00:07:28,250
You can see we've got the option there puts in a circle into our world.

141
00:07:28,250 --> 00:07:31,580
Let's change the color of this circle to B, I don't know.

142
00:07:31,610 --> 00:07:32,570
We'll make it a blue.

143
00:07:32,600 --> 00:07:35,210
We'll say kind of a mid type of blue.

144
00:07:35,240 --> 00:07:35,810
Excellent.

145
00:07:35,810 --> 00:07:37,550
So now we have a circle in our world.

146
00:07:37,550 --> 00:07:42,140
I'm going to get w move this over to the left scroll in a little bit so I can see it.

147
00:07:42,140 --> 00:07:47,150
And there I have a circle and what I've been doing kind of accidentally but I'll pretend I did it deliberately,

148
00:07:47,150 --> 00:07:52,550
is I've made a ground and I've made the head of a person that's going to be running around in my little

149
00:07:52,550 --> 00:07:56,420
pretend platform, a level that I showed you at the start of the video.

150
00:07:56,450 --> 00:08:00,530
The next trick I want to show you is that you can duplicate your game objects.

151
00:08:00,530 --> 00:08:05,870
So while I'm selected on my circle, either through the hierarchy or from my seen window, if I hit

152
00:08:05,870 --> 00:08:11,120
control D or it's command D on the Mac, you can see we now have a new object in our hierarchy.

153
00:08:11,120 --> 00:08:16,100
It's called Circle One and I can move that to the side and I now have a second circle.

154
00:08:16,100 --> 00:08:19,730
And then the other thing I wanted to show you at the moment, when I move around my object, you can

155
00:08:19,730 --> 00:08:22,820
see, oh, the circle goes behind the world.

156
00:08:22,820 --> 00:08:23,270
Why?

157
00:08:23,270 --> 00:08:23,930
Why is that?

158
00:08:23,930 --> 00:08:24,560
What's in front?

159
00:08:24,560 --> 00:08:25,250
What's behind?

160
00:08:25,250 --> 00:08:30,170
If you look over in the inspector, when you click on a particular game object, you can see the order

161
00:08:30,170 --> 00:08:31,070
in layer.

162
00:08:31,070 --> 00:08:34,549
So all of these things at the moment are just on the one default layer.

163
00:08:34,549 --> 00:08:40,059
And if I say the order is higher, then it will be rendered or drawn on top of the other thing.

164
00:08:40,159 --> 00:08:42,380
So I say this circle is ten.

165
00:08:42,380 --> 00:08:45,920
Then when I drag it down here, it will appear over the top.

166
00:08:45,920 --> 00:08:47,870
This other one, where is it going to be?

167
00:08:47,870 --> 00:08:48,860
It's going to be behind.

168
00:08:48,920 --> 00:08:53,060
If you want something to appear on the top of the other things, give it a higher number, for example,

169
00:08:53,060 --> 00:08:53,450
ten.

170
00:08:53,450 --> 00:08:57,260
And if you want it to appear underneath, give it a lower number, for example, zero.

171
00:08:57,260 --> 00:08:57,560
Okay.

172
00:08:57,560 --> 00:09:02,420
So with all that knowledge, I have a challenge for you and I urge you any time you see this challenge,

173
00:09:02,420 --> 00:09:07,520
slide with the pause button down the bottom and the green border around it to pause the video and to

174
00:09:07,520 --> 00:09:08,480
take on this challenge.

175
00:09:08,480 --> 00:09:13,190
This is how you will get the best learning out of this course using only basic sprites, create a pretend

176
00:09:13,190 --> 00:09:15,920
platform, a level, and to note this is just for fun.

177
00:09:15,920 --> 00:09:17,360
We won't be using this in a game.

178
00:09:17,360 --> 00:09:21,260
We're just going to play around with it, give you a chance to understand the unity interface and then

179
00:09:21,260 --> 00:09:22,340
we won't be using it again.

180
00:09:22,340 --> 00:09:25,160
So don't put 10 hours into it, just put a little bit of time into it.

181
00:09:25,160 --> 00:09:30,380
But once you create something, I'd like for you to share a screenshot of this on the Game Dev TV Discussion

182
00:09:30,380 --> 00:09:35,600
Forum, and if you're not sure how to do that, I'll show you that process when you come back from creating

183
00:09:35,600 --> 00:09:36,530
your platformer.

184
00:09:36,530 --> 00:09:38,480
So pause the video, take on that challenge.

185
00:09:38,480 --> 00:09:39,830
I'll see you back here when you're done.

186
00:09:43,140 --> 00:09:43,500
Okay.

187
00:09:43,500 --> 00:09:43,950
Welcome back.

188
00:09:43,950 --> 00:09:46,290
I'm going to get myself a dude.

189
00:09:46,320 --> 00:09:47,010
Here's the head.

190
00:09:47,010 --> 00:09:52,680
Just make it a little bit smaller and then right click to the object's sprite square, move that into

191
00:09:52,680 --> 00:09:53,370
position.

192
00:09:53,370 --> 00:09:58,140
Just do a little bit of editing T to make a body sort of shape thing.

193
00:09:58,140 --> 00:09:59,820
This is not going to be great art, by the way.

194
00:09:59,820 --> 00:10:05,850
So set your expectations low control D to make another one of these hit w move it over to the right.

195
00:10:05,880 --> 00:10:10,020
T To just readjust it a little bit e to rotate.

196
00:10:10,020 --> 00:10:14,700
So what I'm trying to do here is to make a leg and then actually I'll change the color while I'm here,

197
00:10:14,700 --> 00:10:18,810
I'm going to click on the color selector, make it the sort of similar bluey color.

198
00:10:18,810 --> 00:10:20,370
I'm not trying to be precious about this.

199
00:10:20,370 --> 00:10:24,690
If you wanted to, you can copy the hexadecimal number down the bottom here.

200
00:10:24,690 --> 00:10:25,380
Copy that.

201
00:10:25,380 --> 00:10:27,450
And then click on one of your other things.

202
00:10:27,450 --> 00:10:31,740
Go to the color selector and paste that color in and it should be the same color.

203
00:10:31,740 --> 00:10:36,750
Now I'm going to duplicate the other leg and rotate that and go through the process there.

204
00:10:36,750 --> 00:10:42,930
The main things I'm going to do, to be honest, duplicate, change the size, change the shape, rotate,

205
00:10:42,930 --> 00:10:43,500
etc..

206
00:10:43,500 --> 00:10:47,790
So I'm going to pause the video now and come back when I've been through this process.

207
00:10:47,790 --> 00:10:49,440
Okay, this is mostly what I've got.

208
00:10:49,440 --> 00:10:53,160
It's inspired by the pitfall that I played as a young lead.

209
00:10:53,160 --> 00:10:58,020
You know, I decided that my character here is too low to the ground, so I drag across all of these

210
00:10:58,020 --> 00:11:01,110
things and then it should move them all at the same time.

211
00:11:01,180 --> 00:11:05,760
I can hit E and rotate all of this character at the same time, make it look like he's doing some sort

212
00:11:05,760 --> 00:11:10,200
of heroic leap to grab this kind of wrong colored rope.

213
00:11:10,200 --> 00:11:10,910
What color is rough?

214
00:11:10,980 --> 00:11:12,240
Brown, black, anyway?

215
00:11:12,270 --> 00:11:12,870
Not too bad.

216
00:11:12,870 --> 00:11:16,500
Clicking on the game window will take away all of the noise, like the camera and the grid lines and

217
00:11:16,500 --> 00:11:18,210
stuff, so you can just see exactly how it is.

218
00:11:18,210 --> 00:11:23,970
And then from here I'll take my screenshot using Windows Shift and then SE that will give me my snipping

219
00:11:24,000 --> 00:11:24,600
tool.

220
00:11:24,600 --> 00:11:28,260
You can use other tools if you want, but this is just what I've got access to and Windows highlight

221
00:11:28,260 --> 00:11:30,930
all of that that will capture that as a screenshot.

222
00:11:30,930 --> 00:11:34,530
Now I'm going to go over to the link that I will have given you against this lecture.

223
00:11:34,530 --> 00:11:37,050
So remember, find the resources area and click on the link.

224
00:11:37,050 --> 00:11:45,480
And I'm going to just say, here's my silly pretend platformer and then paste that will upload the image.

225
00:11:45,480 --> 00:11:49,530
And then we go, You should see that at the very, very top of this particular forum post.

226
00:11:49,530 --> 00:11:54,180
When you're in on the forum and just click on reply and you can add yours below this and I'd love to

227
00:11:54,180 --> 00:11:54,630
see it.

228
00:11:54,630 --> 00:11:55,170
So there we go.

229
00:11:55,260 --> 00:11:56,250
That's all for this lecture.

230
00:11:56,250 --> 00:11:57,660
I will see you in the next one.

