Particle system is a Unity function used to create effects such as sparks and flames in a scene.
By using 3D models, landscapes, and animations, creators can create almost anything with Unity, but by using the particle system, creators can express their creativity even further.
In this article, I am going to introduce the basics of the particle system, and a tutorial of how to install a particle package and use it.
- 1 Add a particle system
- 2 Change settings in the Particle Inspector
- 3 Particle package
Add a particle system
Select 「Game Object」→「Effects」→「Particle System」 from the menu bar.
A animation like a white sphere will become added to the scene. This is a particle.
Select Particle System in the Hierarchy window, and a window named ‘Particle Effect’ will appear at the bottom right of the scene. This is called a preview panel.
Details of the particle is shown in the preview panel.
|Pause||The animation will pause by clicking it.|
|Restart||The animation will restart by clicking it.|
|Stop||The animation will disappear by clicking it.|
|Playback Speed||This is the playback speed of the animation. You can edit it by changing the number, or by moving the arrow on the right.|
|Playback Time||This shows how much time has passed from the start of the animation.|
Other information isn’t that important now, so you can put those aside for now.
You can move, rotate, zoom in and out particles just like 3D models.
You can set where the sphere appears, or change the effect so that the sphere drops from the sky, as in the image below.
Change settings in the Particle Inspector
There is a Inspector window for particles, just like 3D models, and you can edit settings.
The items vary according to the particle type, but I will introduce important items and common items.
Sets the time that the particle is visible.
If you set the loop OFF, the animation will end after the duration time pasts.
If you check the loop option, the duration will become the time for 1 cycle of the animation.
This is the setting for whether the animation loops or not. If you set this option, the animation will loop.
If you set this option, the animation starts immediately.
This is the time until the animation starts. If you set this option, the animation will be start after the delay time.
※Cannot be active if Prewarm is checked.
This sets how long the particle is visible.
If you set the number larger, each particle will be displayed for a longer amount of time.
This sets the display speed of the particle.
This changes the size of each particle. If you set the number larger the particles will become larger.
This sets the direction of the particle when it appears.
The example particle is a sphere, so this option doesn’t matter, but you may use this option when you are dealing with a particle with a different shape, or when applying materials.
Sets the particle color. If you click the white long rectangle, the color picker will appear, and if you select a color, the particle will become that color.
Applies gravity to the particle.
The default is 0, and as you make the number larger, the gravity applied will become larger.
Sets the max number of particles that appears within the screen.
If the number of the particles reaches this number, no more particles will appear.
If the number of particles decreases, new particles will be created.
Particle number transform equation
There are many items where you can change the number to change it, such as speed or size, but the number is fixed by default.
But you can change this so for example, the particle speed will gradually increase.
If you click the ▼ mark on the right of the number, a menu as in the image below will appear.
Each element’s description is as below.
|Constant||The default setting, meaning a fixed number.|
|Curve||You can draw a graph, and the number changes according to the graph.|
|Random Between Two Constants||You select 2 numbers, and a random number between those 2 will be selected.|
|Random Between Two Curves||You draw 2 graphs, and a number between the 2 will be selected randomly|
How to create a Curve graph
If you select Curve or Random Between Two Curves, a graph as below will appear.
The left edge of the red line is the start position, and the right edge is the end position.
You can click, drag and drop a point on the red line, and move the line to form a graph.
There are many sample curves shown below the graph, and if you click one, the curve will become applied to the graph.
That will be all for the basic settings for particles.
So, we have learned how to set particles, but it is difficult to create an animation we like just by creating a sphere.
But there are many particles in Unity which we can use.
Let’s import a particle package and create a particle in our scene.
Select 「Assets」→「Import Package」→「ParticleSystems」from the menu bar.
A package with a list of particles will appear, so please import it.
Open 「Standard Assets」→「ParticleSystems」→「Prefabs」 from the Assets folder, and you can find a list of the imported prefabs.
You can use a Prefab by dragging and dropping it into a Scene.
Please try out a prefab of your choice, and run the scene.
We have successfully added a fire particle to a scene.
As in this tutorial, by using a particle package, creators can easily add animations of their choice to a scene. I hope you try out animations you like.