Hello guys.
Welcome to the video.
In this one I want to show you how to improve game visuals and how to improve players visual effects.
So I want to create a dust effect.
And when player jumps or lands on the ground or does any other action, you can make a dust particles.
And also if you want you can use this for enemies as well.
Uh, later on.
But I'm going to show you how to set up this only for the player.
Okay?
So, uh, to make a dust effect, we're going to use particle system.
And you should know that particle system is easy to learn, but very hard to master.
You can make so much of different visual effects with particle system.
It's basically like, you know, drawing.
You can do so many things.
There is entire profession for the people who works with particles, and it's very cool one but I'm
not very strong at this part.
I just know some basics, a little bit of it.
Mostly I use assets if I need visual effects, and nonetheless, even if it's like drawing, I still
can show you how to draw a circle, right?
So I'm going to show you how to make a very simple but pretty nice particle effect that will look like
a dust from the player.
Let's go.
So what we need here is, uh, right button effects particle system.
And even from the start.
If you focus on this, you can see it creates particles.
Very nice.
One of the problem here, it shoots them up like that.
And that happens only because of the rotation.
And also position is way off.
So let's do reset and let's find it.
Now it's going to be in the middle over here just where we have the player.
And if you go to 3D mode you can see they flying away from the camera.
Okay.
That's good for now.
Uh, let's go back to 2D mode, and we want to make them visible.
And for that I'm going to go to renderer.
And we can switch certain layer to something else.
I think I'm going to choose player and I'm going to do minus one.
So it will be behind the player.
Nice.
Next step would be to replace this, uh shiny spheres with something else.
Something more suitable for the pixel art.
We just need to go to materials over here and replace it with a sprite default.
Now it looks more like pixels.
Just what we need.
There's a couple of more steps we need to do.
So stay with me.
Um, I want to replace the white square with a dust particle image.
And we have that image.
Although if you really like, you can use these squares as well.
They work perfectly fine.
We need to go to graphics.
Other.
And there is this dust particle.
Let's make pixel per unit 16 apply.
Then on the particle system, we need to go way down somewhere here, find texture sheet animation and
we need to enable it.
Now.
Once you enable it, it's going to work and you can do different settings here.
I'm not going to explain every setting because it would take way long because, you know, the particle
system is such a good tool that you could make an entire course just on particle system, honestly.
So we're going to go briefly over some basics.
All right.
We're going to switch to sprites over here.
And this will make it use sprites for the particle system.
And then we need to take the dust particle and drag it here like that.
Now you can see it was replaced with dust particles.
And it looks much more like what we need.
Now I'm going to close texture sheet animation because we're not going to need it for a while.
And let's close the renderer.
The next step I would like to take here is to change the shape of particles behavior.
As of now, you can see they flying on like into all sides on 360.
And it has sort of a circle shape.
We need to go to shape over here and change the cone to box.
Now it will be in the box much more manageable.
And what we want to change here is the scale.
Because as of now it acts like a cloud, which by the way, could be used for the cloud.
Why not?
You can place it at the top of the level.
And this would be the clouds for you, you know.
Very cool one, but we need the dust.
So we're going to take the player.
Let's bring it on the platform here.
And let's place this particle system at the feet of the player.
Somewhere here.
Like that.
So even though it looks cool and could be used for many different things, we know that it's not suitable
for the dust effect.
For the dust effect, we need to make a smaller field.
So let's make one on the X and let's make zero on the Y.
Like that.
Now it is at the feet of the character.
Very nice.
The next step I would like to take here is to make them fly up and left every time we use them.
So we need to go to velocity of our lifetime.
And this will change velocity of the particles during the lifetime of the particles.
And.
And you can set a lifetime over here.
But as of now, we're not going to touch it.
We're just going to change velocity.
Let's make velocity minus one on the x.
So it's going to fly to the opposite side of the face in direction like that.
And then let's make it one on the Y.
And it's going to fly up and left.
If you want to make it more vertical you can make it as two over here.
Yeah more vertical.
Put the bigger value I think two is fine.
Very nice.
Um, we're going to come back to the velocity of our lifetime later on.
We need to change this space over here.
But first, I want you to see how it works right now.
So later on, you understand, why do we change it from local to world?
Okay, now this obviously good, but it's kind of too much for the dust effect.
Uh, let's go all the way up, and let's change duration from 5 to 0.1.
And.
Let's go to start lifetime and change it from.
Oh five.
To 1.25 like that.
Now we can see it acts differently.
There is like like, you know, it acts differently.
It flies less.
That's what it does.
And.
The last thing we could change here is the density.
Like how many of the particles are there at the moment?
We have, uh, ten over here and we can change it for 50.
Now there is even more of them and all what we need to do is to enable them for a split second and that's
it.
To do that, we can go ahead over here to the main part of the particle system and we need to uncheck
looping.
So now it's stopped.
And every time you play the particle it's just going to do a little bit of the particles like that.
And it looks like a dust, right?
Very nice one.
Also, we need to uncheck play on awake so it will not be played once you start the game.
And we almost done here.
It's pretty much the end of it, except that now particles disappear in kind of like immediately.
And it looks okay.
But we could do it better by going to the.
Color over lifetime, and this will change color over the lifetime of the particle.
And over here we can go and set transparency to zero in the end.
So during its lifetime it's going to go from white to transparent.
All right.
Let's see it again here.
And it disappears like that.
Like a real dust effect.
Very cool.
I love it so much.
And now we can go ahead, try this particle.
And then we're going to change the local space for it.
Okay.
Let's change it to dust Ethics and let's go to Asset Prefab.
We fix and we're going to drag it here.
So we have a prefab.
And we can use it later on for other objects if we want to.
And let's go to player drag it here.
And let's just make sure it is at the feet of the character.
Um.
Looks good to me, I like it.
Now let's go to player.
Player script.
And we need to make a new variable.
We have player visuals over here with a suffix.
So I think we can do serialize field.
Private particle system.
I'm so sorry.
Let me try again.
Particle.
Particle system.
Dust effects.
Okay.
And then we just need to play this particle whenever we want to play dust, for example, when we land
on the ground.
Whereas the handle ending here I'm going to do.
Does the fix not play?
Now let's go and try again.
We want to do.
When we do, we'll jump, right?
Whereas the wall jump.
Here.
We'll jump.
Let's do.
That's the fix dot play.
And we're going to call it a couple of times.
So I'm going to copy this line of code and just find places where I want to enable dust particles.
I want to do it at the double jump.
So I'm going to do it here.
And I want to do it when I jump.
So I'm going to do it here.
And I want to do it.
Maybe when I wall slide.
Do we need to do it when we wall slide.
Okay.
Let's not do it when we will slide because that would be too much I think.
Uh, actually, I want to try.
Really?
Let me try.
And when we handle wall slide we're going to enable dust and.
That's probably it.
So handle ending.
Jump.
Double jump.
Wall jump.
And we'll slide.
Okay.
Let's save this.
Let's go back.
And now we need to assign this variable over here.
Let's drag that fix over here.
Going to apply overrides.
And we can go to play mode.
And you'll see that we create particles, but they follow the player like that.
Not really cool.
So what we need to do here is go to the dust effect.
And also there was too many particles.
I'm not sure why.
Let me check.
Um.
Yeah, we're going to change simulation space to world, and we're going to go ahead and change, uh,
space on the velocity to world like that.
Nice.
Now let's try again.
And now you can see particles are not following the player they staying behind.
Why do we create so many of them?
Is it because we call this on a handle wall sliding?
But do we?
Oh, my God, I'm so sorry.
Let me check, because I kind of forgot how it works.
Oh, we probably need to do it here.
This was so funny.
Let's save this and let's go back.
And now we have.
Let's go to play mode.
We have the player and if you jump, you create dust.
If you land, you create dust.
Very nice.
I like the effect.
And let me try the wall slide.
That's too many.
I think it doesn't look as good as it could, so probably we have to.
Maybe if it would be closer to the wall.
But I don't want to use it, so I'm going to remove it from here.
Because I want it to be simple.
And now these particles are kind of big.
So you could make them smaller.
And let's go ahead and try this in the play mode that changes.
Yeah.
If you go to start size and change it to something like 0.75, for example, the uh, that's going to
be smaller and maybe it's a bit more suitable for the game.
Right.
Also, there is one nice feature that we could use, and I kind of like it just going to show it to
you.
We can go ahead and enable collision for these particles.
And then over here, we need to change it to world and change mode from 3D to 2D, and we don't really
need to do anything else for now, just like that.
And now you can.
And now you can go make particles and you can see they are bouncing off the walls and of the ground.
So if you like this effect, you can use it.
Personally, me, I think I like it because it bounces off the player of the walls of the like every
object in the game.
Also, you can make bounce effect much bigger like three and it's going to behave crazy.
That's too much.
Maybe 1.5.
Now.
Even that is a lot.
Let me try 1.1.
Yeah.
So if you like this effect you can use it also suitable.
I'm going to keep it at point 75.
Yeah, like it this way.
It feels like it's not bouncing off the walls, but player just pushing it with with his body.
And there is also dumping.
If you increase it it will kind of become heavy.
So now I'll set it to one and you can see they are just barely moving.
So this is also suitable.
Why not?
And the last feature over here that I really like.
Uh, you can go ahead and increase duration, for example, to point seven.
Sorry.
Point seven.
Now, when I jump, it's gonna leave a trail like that.
And if you like this effect, you can use it maybe a bit smaller.
Point four.
Yeah, still too much.
Feels like you're creating a snow trail, but worth knowing that you can do that.
For example, you can make some effect for the second layer, and if you have this trail, then second
player walks faster behind you.
You know, different things could be done.
So many uh, let's try point two.
Okay, I'll leave it at point two for now and I'll remove dumping effect.
I don't like it.
Still too much.
I'm so sorry.
I feel like it's too much.
Let's do 0.1.
How it was.
Yay!
Okay.
Very good.
If you want them to disappear earlier, probably you need to decrease lifetime.
And they'll not leave as long.
Oh, this looks good to me.
Okay, now I need to save the settings I did here.
So I'm going to click Copy component.
Go out of the play mode and I'm going to do paste component values.
And then I'm going to just apply overrides.
All right.
So we did create a dust effect.
And if you want to use it for other objects you can for example, you can enable particles when Reiner
hits the wall or when bullet hits the wall or any other suitable situation, you know?
Yeah.
Uh, last thing over here.
Just want to show you this.
I'm going to duplicate this particle, place it above, and.
Where is it?
Uh, how you could do different things with particles.
This is just one of the examples.
Like, you just need to use your imagination and play with it for a while, because if you see it for
the first time, it's pretty confusing.
But if you play with it for a while, if you try different things, you pretty much understand how it
works.
Uh, we can increase the shape.
To something wider like that.
And, uh, let's do looping.
And let's do dumping.
Of 0.5.
Now if you play them.
Uh, sorry.
We need to disable velocity over lifetime.
Let's do zero on the X, and let's do minus one on the Y.
And let's increase duration.
To one and start lifetime two three.
And now you have sort of a snow effect.
We can increase the shape on the Y.
And there it is.
Restart the snow, right?
Very cool one.
You can increase velocity on the Y.
More like minus five.
And it's going to fall.
And even going to bounce as you can see a little bit.
So that could be rain for example or snow or any other effect.
Just place it higher.
Look how it falls.
You can control collision with different objects.
Uh.
Over here.
You just said what it collides with.
And you can do different things here.
Really nice one.
This one really looks like a snow.
So yeah.
Why not to keep it.
So on some levels you can use it.
Anyway, this was one of the examples and thank you so much for paying attention.
I'm going to change it to.
Snow a fix.
Maybe you want to use it.
Just play with parameters a little bit more to improve it.
And I'm going to go to fix.
Drag it here.
It thinks it's the same prefab.
Let's do original prefab.
Okay.
And we're good to go.
Thank you so much for paying attention.
I'll see you in the next video.