VFX in Unity: Getting Started

Learn how to create your own custom visual effects using Unity’s built-in Particle System. By Ken Lee.

5 (2) · 1 Review

Download materials
Save for later
Share

Whether you’re playing a video game or watching a movie, visual effects (VFX) are a big part of the experience. In Unity, you can create VFX with the Unity Particle System, which has almost every feature you need for stunning visual effects.

Unity provides so many settings that the Unity Particle System can be hard to learn. Even when looking at examples of particle effects from the Asset Store, it’s easy to be completely lost when looking at the hundreds of settings in those examples.

You can overcome this barrier by learning some basic settings that create basic effects, giving you a better understanding of how different settings affect the visual effects themselves.

You’ll try some exercises to make basic projectile effects in this tutorial, like firing bullets from a gun or casting magic missiles. Projectile effects are common in many games.

You’ll also learn the following:

  • The four key attributes of particle VFX.
  • How to create the muzzle VFX.
  • How to create impact VFX.
  • Making different projectile effects.

The materials for this tutorial were built in Unity version 2020.3 LTS, but you’ll be able to follow along with any version of Unity from 2019.4 LTS onward.

Note: This tutorial requires basic knowledge of the Unity Editor and C# programming. If you’re new to Unity development, check out our tutorial on Getting Started With Unity.

Getting Started

Download the starter project by clicking the Download Materials button at the top or bottom of the tutorial. Unzip its contents and open the ProjectVFX – Starter project in Unity.

After the project loads, you’ll see the RW folder in the Project window. The folder structure breaks down as follows:

  • Materials: Materials for the scene.
  • Prefabs: Prebuilt components composed of scripts and models.
  • Prefabs/VFX: The base components for building the VFX.
  • Prefabs/Models: The models used in this tutorial.
  • Scenes: The project testing scene.
  • Scripts: Scripts for the projectile and other utilities.
  • Sounds: The sound this tutorial uses.
  • Textures: The graphics that the materials for the particle use.

Now, open the DemoScene from RW/Scenes and click Play to try it for yourself!

The project includes controls for you to move the camera around and switch between different effects. For details, please see the onscreen help at the bottom of the scene.

Testing the VFX

When you work on any visual effects, you should set up the test environment like the Starter Scene.

A good environment helps you answer the following questions:

  • Is the VFX too big or too small?
  • Is the VFX too dim or too bright?
  • How does the VFX interact with other objects?

Sometimes, the VFX will look great in the Prefab view, but the actual scene doesn’t look as good.

Setting up the Testing Environment

Here are the points to consider when setting up a testing environment:

  • Light: The brightness of the environment. This factor will affect the visibility of the VFX.
  • Reference Objects: The reference objects used to compare sizes with your VFX.
  • Launch Control: A key or a button to fire the particle effects.
  • Selection Control: Helps you switch between different effects.
  • Camera Control: Helps you look at the effects from different angles. VFX that are fine from one view angle might not look good from another.

For projectile VFX, consider this as well:

  • Objects for Collision: Objects that collide with the projectile to trigger the impact effects.

This is how the test environment for your demo project looks:

Projectile Testing Environment containing a shooter character, a projectile, its target and some help instructions

Next, you’ll learn about four attributes you’ll need to manage to make great-looking effects.

Understanding Particle Effects’ Key Attributes

Although you can create a vast variety of different visual effects, they all have four key attributes:

  • Size
  • Shape
  • Color
  • Timing

You’ll cover each of these in more detail next.

Size

Size determines how big or small the particles are. Size comes in two levels of granularity: The whole bunch of particles and each single particle.

When you determine the size of a particle, pay attention to how it looks:

  • Relative to the objects in the environment. Place reference objects in the test environment to check if the scale makes sense compared to other objects.
  • Based on gameplay. For example, whether the size of the explosion is the same as its hit area.
  • Based on real-world knowledge. Size should make sense relative to how things look in the real world. For example, sparks are tiny, while smoke is similar to the bullet’s size.

Different particle sizes

These tips only give you a rough idea of how big your particles should be. It’s your job to adjust the size to the right value for your scene. You can apply the Goldilocks principle to find the sweet spot.

Shape

The Shape attribute determines the shape of a particle effect. It gives you the power to define shapes for either individual particles or the whole bundle.

Here’s a simple demo of different shapes:

Different Particle Shapes

Color

Color affects the nature and mood of the particles. You can use them to give hints about what is happening in your game. For example, the yellow and orange palettes are associated with heat or fire, while dark yellow and green palettes bring poison to mind.

Here’s a simple demonstration:

Red/orange particles looking like fire, cold blue particles looking like ice, and green/yellow particles looking like poison

Timing

Timing affects how long a particle effect shows onscreen. When setting the time duration of a particle system, you can choose between instant and continuous.

For instant timing, the particles spawn, then immediately disappear. For example, the sparks that appear when two swords hit together would call for instant timing.

For continuous timing, the particles keep spawning until they time out or the owner stops them. The flame of a torch is a good example.

Here’s an example of an instant particle system at various speeds:

Particles with different speeds: Slow, fast and burst

Keep in mind that it’s important to set all these attributes when you define your VFX. In the coming section, you’ll revisit these attributes and get some hands-on experience using them.

Making a Projectile VFX

Now, it’s time to make the VFX for your projectile! Your goal is to create the main Projectile, then complete its look by adding two more effects: Muzzle and Impact.

  • Muzzle: Spawns at the launching position when the user creates a projectile.
  • Impact: Spawns when a projectile hits an obstacle. The effect will appear at the collision’s location.

Here’s a summary of the projectile life cycle:

You’ll start with the muzzle effects.