Basic Particle Workflows in Unity: Take Control of Your Simulations

Nearly every single game you play is going to feature some type of particle system, whether it's the snow swirling around the environment in Destiny, or the colorful effects as you cast your spell in Dragon Age: Insquistion. Particles add appeal and interest in areas, and help to create a more immersive world. How interesting is it that something as small as a particle has such a big impact on your game? These little guys can do a lot of different things, from creating sparks and fire effects to liquids and a whole lot more. Of course, one single particle is not going to do a whole lot to your game, but when in high numbers, that's when you'll really start to see the effect a great particle system has. For instance, if you wanted to create a puff of smoke, one particle isn't going to do a whole lot, but when many are arranged together, that's when you'll start to see a thick puff of smoke form. Most game engines feature some type of particle system allowing you to create these types of effects, in this article, we are going to take a look at Unity's particle system and learn how we can use it to create some great looking effects for our own games. The particle system in Unity is essentially a series of textures displayed in large numbers. A single particle doesn't look like much, however, when you adjust some of the basic parameters in the particle system you can create varying effects, like fire or smoke. Depending how realistic you want your particle effects to be will determine how you go about setting up the system. Since the particle system is a series of images, an often technique is to create or find a sprite sheet online. A sprite sheet is essentially an animation cut up into individual images for each key frame. So if you wanted to create a fire system, you would create a new material with the sprite sheet applied, and adjust the parameters of the particle system to properly display the sprites in a believable way.

Getting Familiar with the Particle System UI

If you've worked with any particle system in another application, whether it's something like Maya or Blender you'll feel somewhat at home when working in Unity. Many of the various attributes work in much the same way, allowing you to adjust things like start speed, duration, rotation, etc, things that you come to expect in a particle system. However, simply adjusting these basic parameters often do not produce the results you want. particle system In order to create your first particle system in Unity, all you have to do is go to the Hierarchy panel and select Create>Particle System. Doing this, however will create a particle system as its own game object, of course, this may be what you want, but it also may not. If you wanted to create a particle system for a particle object you can select that object and go to Component>Effects>Particle System. This will add the particle system as a component to that particular object. particle system image 2 As you may notice, a very basic particle system is spawned into the game scene, it doesn't look like much more than floating orbs that eventually disappear. That's because the particle system is at its default state, and like any particle system it requires a lot of fine-tuning to get it to look like what you want. particle system image3 By default, the particle system only has three other modules visible, Emission, Shape and Renderer, however, it's important to keep in mind that this is not the breadth of your editing capabilities, this is the particle system at its default state. You can enable all the parameters by selecting the "+" icon at the right of the particle system and choose "Show All Modules" this will show not only the active modules, but also the inactive. Now you'll have various attributes like Collision, External Forces and more. To activate a module you simply check the box. If you're unsure what effect each module has on your particle system you can hover your mouse over the module in question and a tool tip will appear giving you a quick description of the module and its purpose. particle system image4 You may also notice that many values have a number tied to it, for instance, the Start Size value is at 1, which may or may not work for the particle system you want to create. A constant value like this means that for the entire duration of the system, the size of the particle is going to be set to 1, but what if you wanted to have the size start very small, and gradually become larger over time? To achieve this type of affect you need to change the type from "Constant" to something like "Curve" to do this you select the small arrow next to the parameter. Take some time to explore each one of these modules, examine their tool tips and try to get familiar with what each one does, and the type of affect it has on the particle system. While you can make any adjustments to the particle system in the Inspector, there is actually a Particle Editor that may be more beneficial when working with complex particle systems as it's much easier to see. It also shows any nested particle systems as well. So inside the Particle Editor you can select the "+" sign next to the main particle, and this creates a new particle system that is parented to the main system. This allows you to create something like a main fire system, with just the flames, and another particle system for just the smoke, and another for the sparks, and so on.

Creating a Simple Particle Effect

image 01 To create a very basic particle system that looks like a flame you can create a new particle system by going to Create>Particle System. You can see that by default, we aren't really getting anything that resembles a flame, however, knowing what parameters to adjust will allow you to quickly achieve the look you are wanting. image 02 With the particle system selected, go into the Inspector and open the Shape module. Right now, the particles are being emitted in a cone shape, this makes the particles flow in a very spread out way. You can keep the Shape type set to Cone, but change the Angle to 0. Now you should see that the particles are flowing in a more controlled way, and staying within the size of the cylinder shape. image 03 Now make sure you have all the modules shown, and check the Size over Lifetime module, select the size tab, and this will open the curve editor. Adjust both keyframes to resemble the image above. This will make it so the particles are largest at the start of the simulation, and over time they slowly get smaller until they disappear. image 04 Finally, go back up to the main particle system and change the start size to something like 4 instead of 1, and under the Emission module change the rate to something like 30. This changes the number of particles emitted per second. You can also adjust things like the Start Speed and Start Lifetime to adjust the speed at which the particles emit, as well as how long the particles take to die off. Now that you have a basic understanding of the particle system in Unity practice around with the many different modules and parameters to try and achieve different effects. If you want to learn more about Unity's particle system check out Introduction to Particle Systems in Unity.