In this video, we are going to learn how to add a sparkling particle effect to our Kart
Racer micro-game. If you’re not familiar, Kart Racer is a game project which you can
download and walkthrough in order to learn Unity for the first time. We’ve put a link
to the project in the description below. As you’re exploring the kart racing micro-game-
you may want to be able to customize it to make it your own. One way to do this is by
adding particle effects!
In Unity, the particle system component allows us to create effects like fire, liquids or
clouds by spawning and animating a large number of moving images in the scene.
One way we can quickly see particles in action is by selecting the confetti celebration prefab
that already comes included with the project - and drag it into the scene. We can preview
how the particle effect looks by selecting it in the Hierarchy and pressing the play
or restart buttons in the Scene view.
To create our own particle system - we can go to the GameObject menu and select > Effects
> Particle System. You can see that it already creates a functional particle system right
away!
When selecting the particle system - we can see that in the Inspector we have plenty of
options to modify the Particles -such as the start speed, start lifetime, start size and
start color.
By modifying the start speed - we can control the velocity of the particles when they are
first emitted. The lifetime property determines how long the particles stay visible after
they are created.
In the emission module, we can change the “rate overtime” at which the particles
are created, measured in particles emitted per second. Let’s try something like 30.
We can also change the shape from which the particles are emitted using the Shape module
- we can select from a variety of options such as a sphere, box, or a circle - we’ll
just keep it as a cone for now.
After choosing to use the cone shape we can modify its variables including its angle and
radius.
There are also some properties that are based on the particle lifetime - for instance, size
over lifetime. By playing around with these settings we can do things like make the particles
shrink or expand over time.
To make our particle system really stand out - we will assign a new glowing material to
it. To do this - we just need to create a new material by going into the project folder,
right-clicking in the location we want to create it in and selecting Create > Material,
let’s call it Glowing Particle Material. If you want to look at an example material,
we’ve provided one in the package linked in the description below.
In the inspector - we can change the material’s shader to Particles > Standard Unlit. This
will mean that the particle is no longer affected by light and shadows, instead, it will be
rendered with a solid color. We will set the rendering mode to Fade. This setting is useful
for objects that need to become fully transparent at some point, like our particles. We will
choose the color mode multiply which will allow us to tint our particles. The albedo
will use an image texture of the default particle sprite. We can increase the brightness of
the albedo color by clicking on the color picker and increasing the intensity property.
This will cause the material to glow when seen through our Bloom post-processing effect.
Now we just need to drag the material into the particle system to cause our particles
to be rendered with our new material.
Since we really want to make our effect pop, let’s also turn up the intensity of the
Bloom effect in our post-processing profile. Let’s try a value of XX. That looks pretty
good. Feel free to play around with the other post-processing settings to change the way
your game is rendered.
Let’s move the particle system closer to the kart wheel and play around with some of
the settings like the particle size, color, and speed. We also have the ability to choose
a random start size between two constants by clicking the arrow on the right side and
selecting Random Between Two Constants.We can also add gravity to our emission by using
the gravity modifier. To make our effect look even better - Let’s add another particle
system with a sphere emission, a start speed of 0 and with the same material and color
as the first one! Let’s make the particle system be a child of the kart object so that
it follows the kart’s position. And that’s it - the particle system has a lot of great
options for you to modify your effect - so feel free to play around with those settings!
Hopefully, this has given you some ideas on how to add particles to your own games, leave
us a comment down below to let us know how you are using particles in your projects.
Just for fun, we’ve also made a few additional particle effects and included them in the
downloadable package in the link below which also contains the material shown and a finished
example of the particle system we created in this video. Thanks for watching!