Right now we need to drag our background.
So let's do that.
We're going to move over to project tab, then assets and then sprites folder.
And we have an environment folder over there I have background.
As you can see we have BG one two and three.
So we're going to drag our background one by one.
So I'm going to select this one.
So let's select that and drag it over to this scene view or in this hierarchy.
So I'm going to drag it into this scene view.
As you can see over here the background looks too much small.
So we need to make it a little bit bigger.
So what we can simply do we can select the sprite then go over to Inspector.
Then we're going to make this pixel per unit a less number.
And we do know that less pixel size means this.
This sprite is going to be big in size.
So I'm going to make it something around 16.
And make sure you go just move over to this filter mode and choose No Filter.
To just get rid of blurry and scroll down.
Then click on this apply button and as soon as we clicked apply, we can see by now the sprite is too
much big.
And we're going to select all of those background and let's drag them as well one by one.
So we're going to select both of these by holding down shift.
And I'm going to select all of my backgrounds.
Let's go to Inspector Pixel per unit I'm going to choose 16 filter mode to point no filter.
And after doing that click on this apply button.
And we're going to select one by one.
And we're going to drag it.
So I'm going to select this one and this one.
But the problem is that this one should be behind of our this ground tiles.
It seems like our backgrounds in front of our ground tiles.
So what we need to do we need to assign some sorting layer.
But before we do, let's uh, let's call this one to something like background one.
Or we can simply call it BG one instead of saying like BG underscore one, underscore zero.
So I'm going to call it BG one or simply for background one.
And we're going to choose the second one and we're going to call this one VG two.
Let's select the third one and we're going to call it VG three.
Uh BG three.
And now it's fine.
Let's assign with some sorting layer.
So we're going to select our first one.
Let's go to Inspector Sprite Renderer then Sorting Layer and click there.
And then click on Add Sorting Layer.
And we're going to create uh three sorting layer, one for this background, one for our uh this one
and one for this one.
So we're going to create three sorting layer.
So just click on this plus icon in the inspector.
And we're going to name this to something like BG BG one.
Sorry I'm going to call it BG one.
And this will be BG two.
So just click on that plus icon in order to add one more sorting layer.
So we're going to click one more time and this will be BG three.
And we're going to drag the BG three all the way behind.
So it should be behind of our all of background.
So that's why we're going to take our BG three and we're gonna drag it top up to make it, uh, to basically,
uh, put it behind.
And then we're going to select our BG two, and we're going to drag it on top of this BG three.
So it's going to be in the middle somewhere like that.
And now we're going to drag our BG one.
And this is seems pretty much cool as you can see.
And now what we have to do we need to assign this background with our sorting layer.
So let's select the BG one in the hierarchy.
Let's add then move over to Inspector Sprite Renderer and then click over here additional Settings and
sorting layer for this BG one.
So I'm going to choose uh this will be the front one.
So I'm going to call it something like uh let's let's leave it to BG one.
So we're gonna click over here Sorting Layer.
And we're going to assign it with BG one.
And now we're going to take the last one or which going to be behind all of our background.
We're going to select that.
And we're going to assign it with Bg3.
As soon as we assign it.
As you can see that background, just set it up in the back.
It just move it over to back.
And now we're going to select the middle one which is Bg2.
And we're going to assign sorting layer to Bg2.
Now as you can see it's uh seems pretty much fine.
And we're going to select all of our background one more time in the hierarchy.
Then go over to Inspector Transform.
Right click and then click on this reset.
So it's going to reset the position.
And what I'm going to do I'm going to make the camera a little bit.
Zoom out zoom out something like that.
So we're going to make it.
So let's select the camera pattern underneath.
We have main camera as you can see.
And we're going to make the size basically the zoom in something like I guess this much seems pretty
much cool as you can see.
And I'm going to drag my main camera.
So let's select this camera pattern, select the move tool from in the scene view, and we're going
to move it somewhere something like this much.
And I'm going to drag it a little bit a little bit up in the y axis something like this.
And what we can simply do, we can make this, uh, backgrounds a little bit small to just, uh, to
just, uh, see all of this background perfectly in our main camera.
So I'm going to select our background sprite.
So we're going to select from that folder.
So we have all of the backgrounds over here.
As you can see we're going to select all of them by holding down shift.
Then move over to Inspector.
And we're going to make this pixel per unit a less number.
And we do know less pixels.
Uh sorry.
We're not going to make it less.
Instead we're gonna make it high, something like 20 to just make this, uh, sprite a little bit small.
So we're going to do with some at something like 20.
And now let's click on this apply button.
And as soon as we clicked apply we can see this background just gets a little bit a little bit small.
And what we're going to do now we're going to select one one more time.
All of this background underneath uh in the hierarchy.
And we're going to move it a little bit up to just capture this area.
So we don't want any gap.
So we're going to make it a we're going to drag it a little bit.
I think it's fine.
As you can see.
And it looks pretty much good by now.
And let's click on this play button in the top.
We should hope it's gonna work fine.
So what we need to do, we need to make parallax effect as well as we need to basically endlessly.
This background should add up in front.
So if we select our player game object in the hierarchy and make the speed a little bit fast, something
like five.
As you can see, we're moving a little bit faster and this seems pretty much cool.
So the background just gets over and over here as you can see.
So what we're gonna do we're gonna duplicate our background a little bit.
So let's do that.
So let's get out of play mode and we're gonna duplicate our background.
So let's select all of this background.
Uh, but before we do let's create an empty game object.
And we're going to call it something like background.
Basically, we're going to create that game object in order to make our our hierarchy a little bit clean.
So let's right click in our hierarchy.
Let's create an empty game object.
And we're going to call this game object to something like background holder.
Or we can simply call it backgrounds instead.
So I'm going to call it backgrounds.
And make sure you just go to Inspector Transform.
Right click and reset it.
And if you just want to choose an icon, you can click over here in the Inspector and you can choose.
So I'm going to select this yellow one.
And now I'm going to take all of this background this BG one B2 and B3.
And I'm going to drag it on top of this background game object.
In order to make this background is a child of this background background game object.
And now we can just click over here to just collapse it at once.
And we can see this is now much, much more clean.
Uh, by now our hierarchy a little bit clean as you can see.
And we're going to make this background a prefab as well.
So we're gonna have the copy.
So let's select the background game objects backgrounds GameObject in the hierarchy.
And let's drag it over to this prefab folder in this project tab.
And now we just turn it into a prefab.
And we are ready to duplicate our background by now.
So let's do that.
So we're gonna select our background.
Let's click over here to in order to expand.
And we're gonna select all of this background by holding down shift.
And we're going to press down Ctrl D in order to duplicate.
And then we're going to select the move tool from in this in view.
And we're going to move it to the right side to just fit this area.
And you need to just give it a perfect number.
So make sure there is no there shouldn't be any gap.
So I guess 100 is pretty fine number.
Or we can just play around with this.
So 100 and 102 five just gonna be a perfect number.
So we're going to put 102.5.
But it doesn't seem So we can just go with the zero five, I guess.
No, two.
And I guess so two seems perfect.
As you can see, we are not able to see any gap between this background and now what we have to do.
We need to select the duplicate one or we just duplicate it.
So in our case this BG one and we're going to drag it on top of this the first one.
So basically make the duplicate one is a child of the first one.
So we're going to select our BG two.
And we're going to drag it top of this BG two game object in order to make it child.
And we're going to select our third background.
And I'm going to drag it on top of this BG three in order to make it child.
And now what we have to do, we need to select our background and make sure go to overrides and then
click on Apple Apply all.
So the changes you made in this hierarchy of this background game object, it's going to be saved into
that prefab of this background game object as well.
And now we can see it's pretty much fine.
And I'm going to make my player speed a little bit fast in order to see that.
So I'm going to select our player GameObject in the hierarchy.
Let's go to Inspector.
And I'm going to make the speed something like uh five point or let's make it something around seven.
And let's click on this play button in order to play our game.
And let's have a look on this.
So just wait.
And we can see this is now pretty much fine.
And we can see the background is also becoming red.
And this seems pretty much fun to play as you can see.
So I hope you get the idea that how you can make this one work and the background just gets end over
there.
So we need to fix that.
So we're going to fix it in the next chapter or next lecture.
We're going to do that.
So let's get out of play mode.