‫All right.
‫So far, we have created a game which does most of the things that we need, but we can improve it a
‫lot by adding some effects whenever we collect a crystal.
‫So what I want to have is an effect whenever we run through crystal and get it.
‫So a little particle effect.
‫And in order to get a particle effect, we can create a new particle effect.
‫So let's click right click into the hierarchy view, then go to Effects and let's add a particle system.
‫So now this particle system here will be.
‫Added.
‫So let's see where it is.
‫Let's go to our sea view.
‫There it is.
‫And it's somewhere at the bottom there.
‫So let's reposition it.
‫Reset to zero zero.
‫So now it's inside of our player.
‫So maybe we should move it over to.
‫Our crystal.
‫So I'm going to change it and move it into our crystal now.
‫So the crystal is at 0.5.
‫I know that then the exposition should be about right and the Z position as well.
‫So we're about right.
‫It's not the perfect position.
‫You can play around with it and see where globally you're.
‫Crystallize and then set it up there.
‫So what this does is, as you can see, it emits particles and it constantly shoots them, as you can
‫see.
‫And actually, I changed the Y rotation.
‫Now let's go back and set that to zero.
‫Now you can see it shoots those effects out and one could think that they are 3D, but actually they
‫are 2D because what what they do is they simply show this 2D image following the camera.
‫So based on how the camera looks, they will show this 2D picture.
‫Now, my PC is laggy and it's lagging a little bit because effects really can decrease your performance.
‫And you can find out more about this when you go to the renderer in the inspector and you can find it
‫that it is a billboard.
‫So this.
‫Particle.
‫Here is a billboard and if you want to know more about it, you can open up the material.
‫So the default material and you find out that it's just this 2D image here.
‫So that's the effect that we currently see all the time in here.
‫Now, the cool thing is we can go ahead to our particle system and then we can change the start color.
‫So you can see the start color is white and we could use any color we want so we could make it red,
‫we could make it purple, you could make it yellow, whatever you want.
‫And I'm just going to use a color which we have inside of our crystal.
‫So that's one of the colors that we have.
‫And what I want to have is not only one color but a random between two colors.
‫So if I do that, I press right click here running between two colors.
‫Now I can choose.
‫A different colour and they will be random in between those two.
‫So I'm gonna choose this blue colour and now you can see there will be blue, purple, red ish.
‫So they will jump around between those two colours.
‫Now the cool thing is that we can change the emission of that particle system as well.
‫So as you can see now, it's constantly creating those particles and we can change that by example.
‫We can add a burst to it.
‫So let's add a burst.
‫And what we can do now is we can say how many bursts we want to have, how many cycles we want to have,
‫and so forth.
‫And also the interval.
‫I don't want them to be to have a rate over time.
‫So I'm going to set that to zero.
‫As you can see now, things changed quite a bit and it will be like a burst coming all out at the same
‫time with a specific duration.
‫So they have a lifetime of 5 seconds and I want to reduce that to 2 seconds, for example.
‫So now it will only be there for 2 seconds and then they will disappear.
‫So they have a duration of 2 seconds, but they still have a lifetime of 5 seconds.
‫So let's change that to, let's say 1/2.
‫So as you can see, it bursts and then the particles disappear.
‫What we, by the way, can change is maybe the X rotation to -90 and then we'll go up.
‫So now they will always burst up.
‫Then they will disappear, boom, and disappear.
‫Now what it does, what this particle system does here is, well, they disappear at one point, so
‫it doesn't look that great.
‫Right.
‫We can change that.
‫And as well, we can change the form in which it comes out.
‫So the shape, as you can see, there is a shape and the shape currently is a cone.
‫But we can change that to, for example, a sphere.
‫So if we want them to be created within a sphere, we can do that and we can also resize it.
‫So let's change the size a little bit.
‫Let's bring it down to like this size.
‫So it will come from this little sphere here in the center, and then it will create those bursts of
‫emissions on those particles.
‫But that's not the only thing we can change.
‫We can change the shape, we can change the radius and so on.
‫But what I want to change as well is that it doesn't disappear straight away, but it fades away and
‫we can do that with colour over lifetime.
‫So currently.
‫It just has this empty color.
‫So let's activate it.
‫And now it's just white.
‫So let's double click here and then the gradient editor opens.
‫And what you can do here now is so click on this little button over here or this little piece over here,
‫and then let's change the Alpha to zero.
‫So you can see that it will go now from having 250 504 to 0 Alpha over time.
‫So let's simulate it.
‫And as you can see now, it fades away step by step.
‫Now I can go ahead and change the particle system even further.
‫You can, for example, change the size over lifetime.
‫So if we would want it to get bigger over lifetime or we could go from big to small, or we could go
‫from small to big as you like, you can play around with the values here.
‫It could start off and then it would change over time.
‫So there are multiple different versions that you can use for size of a lifetime, but I'm just going
‫to deactivate that.
‫And of course you can play around with all of those things here.
‫For example, also the noise.
‫You can have a noise.
‫As you can see now, it floats into different directions.
‫It's not so easy to see here because it's a bit laggy, but other than that, you can change the noise
‫here.
‫For example, you can change the strength so that the noise is not as strong.
‫So now it looks a little bit like there is a wind which floats randomly and changes to particle system.
‫Next, let's randomize some of the things.
‫So for now we have a start lifetime of 1/2.
‫Maybe we should reduce that to 0.5 seconds so that it doesn't go as far.
‫Then we can change the start size.
‫We could go ahead and use a random between two constants so the size could be between 0.1 and 0.5,
‫for example.
‫So now it's a bit smaller.
‫They're a bit well, a bit more controlled.
‫Then it start speed.
‫We could even do that.
‫We can even change the start speed a little bit random between two constants.
‫So let's go here between 1.5 and two.
‫So now the speed is randomized of those particles.
‫So you can see you can randomize many things here.
‫It's a lot about playing around and seeing what you like, what looks best for you.
‫So maybe point two and point four would be a better choice.
‫So the idea behind it is that you find something that looks great and just does the job and that you
‫really like.
‫Now let's set the lifetime random as well.
‫So random between two constants for the lifetime.
‫And let's go to 1.5 to 2 seconds.
‫Let's see how that looks.
‫Maybe it's a bit too big, so go 0.5 and one.
‫So now we all have a lifetime, which is random for each particle.
‫You could even go ahead and create your very own effects so you can simply create a your own billboard.
‫Or you can yeah, you can simply use an own image that you have here.
‫So as you can see, it's just a 64 times 64, 32 bit default particle, which is just a file, and you
‫could create a circle yourself and yeah, you can set it up as you like.
‫All right.
‫So now let's save that particle system and let's rename it first and call it crystal effect.
‫Now let's drag that into our prefabs.
‫So let's drag the crystal effect into our preset prefabs.
‫Now, we can get rid of that crystal effect because we have it as an as a prefab.
‫So let's delete that.
‫And now let's go into the character script.
‫So here character and.
‫Chart controller and create a public game object crystal effect.
‫Well, let's save that.
‫Now, let's set that into our character.
‫So after a couple of seconds, we should see that here, the crystal.
‫Affect.
‫That we are.
‫Crystal effect.
‫Let's go to assets prefabs, which is our character again and drag the crystal effect in there.
‫Now let's go back to our script.
‫And set that up.
‫So when do we want the crystal effect to be shown?
‫Well, whenever we collide or whenever Trigger Enter is called.
‫So whenever we hit a crystal.
‫So the means within this if statement, we want to go ahead and create a game object called G and instantiate
‫that.
‫And what do we want to instantiate?
‫Well, we want to instantiate our crystal effect game object.
‫And where do we want to instantiate it at transform dot position.
‫So at the position of our player and as the criterion, we just set up criterion dot identity.
‫So no rotation.
‫Then we destroy that game object g after a lifetime of 2 seconds.
‫So we just say you live for 2 seconds and then that's enough.
‫And now we of course may not forget to destroy our crystal itself.
‫And we do that here at the bottom.
‫So we create our crystal effect at the feet of our player.
‫Then we destroy it after a couple of seconds of the 2 seconds, to be precise, and then we destroy
‫the crystal as well.
‫We don't do that after 2 seconds, we do it straight away.
‫So now let's save that script and let's go into our game and let's have a look what happens.
‫So now let's press enter.
‫And as you can see, there is this crystal effect which does what it should.
‫Maybe it's a bit too big, but whatever you could change it and well, change it to your pleasing or
‫to your liking.
‫What we could, of course, do is start the particle effect, not at the feet of our player, which
‫happens now, but at the centre of our player.
‫So it could be at the chest of our player.
‫And what was it, the chest of our player?
‫Well, our race start.
‫Game object.
‫So we could do that.
‫Let's have a look at how and here we don't do the transform position, but we check the.
‫Ray start transform positions.
‫So let's go to ray start dot transform dot position.
‫And actually it was called like that.
‫So now let's see what happens.
‫Let's go to our character and.
‫It has a started already.
‫That's perfect.
‫So now let's have a look.
‫And you can see now it comes from roughly the chest.
‫So the center body or center point of our player.
‫Great.
‫So that about effects.
‫Of course, you can play around with effects.
‫You can check out every single detail of these effect settings and play around with them.
‫And then you will see that there is plenty to do.
‫And in the end, it's all about how it fits into your game.
‫In the next video, we will have a look at it.
‫Setting up background music for our game.