Hello again in this lecture will be playing around with unity, learning the interface and creating
a silly little pretend platformer that we will then go and take a screenshot and post on the Game Dev
TV forum.
So let's get started.
Let's start this process by making ourselves a new project, Open Up Unity Hub, and then find the new
button.
If you've got more than one version, you can click on the little arrow to the right of news, select
the version that you want, click on that, and then click on 2D to say it's a 2D type of project.
Name your project I'm going to call mine experimenting because we're just goofing around.
And then of course, choose a location on your harddrive where it will save and then click the create
button and we're good to go.
This will take a few moments.
I'll pause my video and I'll be back when mine has loaded and ready to go.
Okay, here we are in unity.
If your window layout doesn't look like this, you can jump up to window layouts and click on default
and it should return to this default layout.
You can move your windows around a whole bunch.
You can move the tabs around where you want to.
So grab a console tab and move it somewhere else.
I'll pop it back there if I can.
Yep.
There we go.
So you can move things around as you like, as is the case with most software nowadays.
Over on the left we have the hierarchy.
If I click the little opening closing thing here, you can see in the hierarchy we've got sample scene.
That's the name of our project at the moment or our level that's in our project.
And I have a main camera that's the only game object I have.
If I click on main camera, you can see over on the right hand side, the inspector has lit up with
a whole bunch of information and that information is telling us all about what's going on with the camera
and we can change particular things there.
So we'll come back to the inspector in a moment.
I want to show you a little bit more about the layout of unity.
Down in the bottom left, we have the project tab.
In here, we have the assets directory.
This is where all the things that are saved on your hard drive will live.
So at the moment we just have the scenes folder in here we have our sample scene.
This is our scene or level, depending upon what you'd like to call it.
And you can see down here it's a dot unity file that's saved on our hard drive.
Anything we change within our scene will be updated within our unity file.
So our scene is in our scene window.
You see up here, we've got a tab that says scene.
That's where all of our game objects will be displayed.
Next to the scene tab, we have the game tab or the game window that is showing us what we're seeing
through our camera at the moment.
At the moment, there's not much of a game in there.
And then we also have the asset store that's changed a little bit.
It used to be you could navigate everything in here, but now when you click, this will open up in
a browser and take you to find a whole bunch of cool assets which will play around with that a little
bit later on in the course.
For now, we're going to add a game object into our hierarchy.
So find the hierarchy in this big open space in here.
Right click to the object and then Sprite.
I'm going to add a more at a square in there.
You can see it's added a square in our hierarchy and we have an opportunity to rename it.
I'll just leave it as square.
And in general, I'll be pretty messy in the hierarchy in this lecture because I don't want to take
you through the organizing the hierarchy because that's a little bit drier.
We'll do that later on.
For now, it is sort of chuck things in there and not worry so much about whether they're named properly
or nice and neat and tidy.
So if I click on square in the hierarchy, it'll highlight over in the inspector what's going on with
the details of the square.
And it will also give me a indication that I've selected this within my scene.
I'm using my mouse wheel to scroll in and out.
You can also hold down alt and right mouse button and move to the left or to the right.
That is another way to zoom in and out.
And if I click and hold down the middle mouse button, I can move around in my world or pan around.
As the case might be.
I can also come up here into the top left and click on the little hand, which is the pan tool.
And then with my left mouse button, I can move around in the scene.
Now I've got my object in here.
It's right underneath the camera, which makes it a little bit misleading.
You see, the main camera, the icon for that is right in the middle of where my square is.
So I'm going to jump up here to my toolbar.
And next to the hand I've got this four way arrow, which is the Move tool.
If I click on that or I click W on the keyboard to get this particular tool, then I've got these handles
showing up on my game object green is to the Y direction or up as we're looking and red is on the x
axis to the right.
So if I grab the red handle and move it right and left allows me to move my game object right and left,
and likewise with the green up and down.
And also there's a little space in the middle where you can grab that and move it on both the X and
the Y.
So I'm going to head over to the right hand side of the screen just to draw your attention to what's
going on over here.
As I move it around, you can see under the position we have X and Y and those numbers are updating
as well.
If I move it down, then the Y goes down.
It's in negative five point something or other.
And up, up, up, up, it's going up.
So I can change the position by grabbing it and moving it around this game object.
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
y and hit my left mouse button or hold my left mouse button down.
That will allow me to drag it.
We can also rotate them.
So if I head up to my next icon in the top left, you can see the little arrows swirling around.
I can click on that or I can click E on the keyboard and you can see we've got this outline around our
object.
If I grab onto the blue handle or the blue circle, hold down.
Mouse button, I can rotate around my object, or as we've done before, I can find where that rotation
is.
It's on the Z or the Z axis and I can do the same sort of rotation there.
I'll put it back to zero for rotation for the moment.
The next button along is to scale, which corresponds to R on the keyboard.
That allows me to grab a handle and to move it to make it bigger or smaller.
Or if you can't quite see it here, but there's a dot in the middle that allows us to move the whole
thing in a uniform way.
Or of course we could scale using our sliders and our numbers over within the transform area.
And then the last one I'll show you up here is the rect transform tool, clicking on that or clicking
T on the keyboard.
So Q w e r t following along on the keyboard that allows me to grab the sides or to grab the corners
and move accordingly so I can get things exactly into the spot that I want, so I can hit W to move
this down to the bottom of my window area.
That's going to make things a little bit further back and then t to move that to the right, move that
to the left, make it a little bit smaller.
And now I've got some sort of thing that could be considered a ground.
Now, also with the game objects here, when I click on the main camera, you can see that we've got
Transform and then we've got camera.
These things are components and a component is what makes it the particular type of game object that
it is.
This is a camera because it has a camera component.
This is a sprite because it has a Sprite renderer component.
And what is a Sprite?
Well, it's a 2D graphic object that we can move around in our world that comes from a bitmap image.
So in other words, it's an image that we turn into something that our game can understand, and we
call it a Sprite.
And the Sprite renderer also has some fields and some values.
So if I click on the white color selector here, I can change the color of our sprite by moving the
selectors on the inside of the square area and around the outside to change the color we've selected
and then X out of that when we're done.
So now we have changed the color through our sprite renderer to make our square a green color.
Okay, let's go ahead and add ourselves.
Another game object I'll give you this to is a little micro challenge to make sure that you're actually
doing this at the same time and not just watching along like a zombie.
So I want you to add a new Sprite into our scene.
Let's see if you can add a circle into our scene.
So pause the video, take a moment to do that.
Okay.
So let's do this together.
If you didn't manage to figure that out, right click in the hierarchy, 2D Object Sprites and circle.
You can see we've got the option there puts in a circle into our world.
Let's change the color of this circle to B, I don't know.
We'll make it a blue.
We'll say kind of a mid type of blue.
Excellent.
So now we have a circle in our world.
I'm going to get w move this over to the left scroll in a little bit so I can see it.
And there I have a circle and what I've been doing kind of accidentally but I'll pretend I did it deliberately,
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
pretend platform, a level that I showed you at the start of the video.
The next trick I want to show you is that you can duplicate your game objects.
So while I'm selected on my circle, either through the hierarchy or from my seen window, if I hit
control D or it's command D on the Mac, you can see we now have a new object in our hierarchy.
It's called Circle One and I can move that to the side and I now have a second circle.
And then the other thing I wanted to show you at the moment, when I move around my object, you can
see, oh, the circle goes behind the world.
Why?
Why is that?
What's in front?
What's behind?
If you look over in the inspector, when you click on a particular game object, you can see the order
in layer.
So all of these things at the moment are just on the one default layer.
And if I say the order is higher, then it will be rendered or drawn on top of the other thing.
So I say this circle is ten.
Then when I drag it down here, it will appear over the top.
This other one, where is it going to be?
It's going to be behind.
If you want something to appear on the top of the other things, give it a higher number, for example,
ten.
And if you want it to appear underneath, give it a lower number, for example, zero.
Okay.
So with all that knowledge, I have a challenge for you and I urge you any time you see this challenge,
slide with the pause button down the bottom and the green border around it to pause the video and to
take on this challenge.
This is how you will get the best learning out of this course using only basic sprites, create a pretend
platform, a level, and to note this is just for fun.
We won't be using this in a game.
We're just going to play around with it, give you a chance to understand the unity interface and then
we won't be using it again.
So don't put 10 hours into it, just put a little bit of time into it.
But once you create something, I'd like for you to share a screenshot of this on the Game Dev TV Discussion
Forum, and if you're not sure how to do that, I'll show you that process when you come back from creating
your platformer.
So pause the video, take on that challenge.
I'll see you back here when you're done.
Okay.
Welcome back.
I'm going to get myself a dude.
Here's the head.
Just make it a little bit smaller and then right click to the object's sprite square, move that into
position.
Just do a little bit of editing T to make a body sort of shape thing.
This is not going to be great art, by the way.
So set your expectations low control D to make another one of these hit w move it over to the right.
T To just readjust it a little bit e to rotate.
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,
I'm going to click on the color selector, make it the sort of similar bluey color.
I'm not trying to be precious about this.
If you wanted to, you can copy the hexadecimal number down the bottom here.
Copy that.
And then click on one of your other things.
Go to the color selector and paste that color in and it should be the same color.
Now I'm going to duplicate the other leg and rotate that and go through the process there.
The main things I'm going to do, to be honest, duplicate, change the size, change the shape, rotate,
etc..
So I'm going to pause the video now and come back when I've been through this process.
Okay, this is mostly what I've got.
It's inspired by the pitfall that I played as a young lead.
You know, I decided that my character here is too low to the ground, so I drag across all of these
things and then it should move them all at the same time.
I can hit E and rotate all of this character at the same time, make it look like he's doing some sort
of heroic leap to grab this kind of wrong colored rope.
What color is rough?
Brown, black, anyway?
Not too bad.
Clicking on the game window will take away all of the noise, like the camera and the grid lines and
stuff, so you can just see exactly how it is.
And then from here I'll take my screenshot using Windows Shift and then SE that will give me my snipping
tool.
You can use other tools if you want, but this is just what I've got access to and Windows highlight
all of that that will capture that as a screenshot.
Now I'm going to go over to the link that I will have given you against this lecture.
So remember, find the resources area and click on the link.
And I'm going to just say, here's my silly pretend platformer and then paste that will upload the image.
And then we go, You should see that at the very, very top of this particular forum post.
When you're in on the forum and just click on reply and you can add yours below this and I'd love to
see it.
So there we go.
That's all for this lecture.
I will see you in the next one.