---
title: "Lesson 3.4 - Particles and Sound Effects"
content_type: tutorial
url: "https://learn.unity.com/tutorial/particles-and-sound-effects?language=en"
language: en
difficulty: beginner
duration_minutes: 60
unity_version:
  - "6.0"
  - "6.3"
supported_unity_versions:
  - name: "6.0"
    url: "https://learn.unity.com/tutorial/particles-and-sound-effects.md?language=en&version=6.0"
  - name: "6.3"
    url: "https://learn.unity.com/tutorial/particles-and-sound-effects.md?language=en&version=6.3"
  - name: "2022.3"
    url: "https://learn.unity.com/tutorial/particles-and-sound-effects.md?language=en&version=2022.3"
  - name: "2021.3"
    url: "https://learn.unity.com/tutorial/particles-and-sound-effects.md?language=en&version=2021.3"
last_updated: "2026-08-04T14:23:58.000Z"
---

# Lesson 3.4 - Particles and Sound Effects

Add music, sound effects, and particle systems to make running, jumping, and crashing feel more dynamic.

**Overview:**

This game is looking extremely good, but it’s missing something critical: Sound effects and Particle effects! Sounds and music will breathe life into an otherwise silent game world, and particles will make the player’s actions more dynamic and eye-popping. In this lesson, we will add cool sounds and particles when the character is running, jumping, and crashing.

**Project Outcome:**

Music will play as the player runs through the scene, kicking up dirt particles in a spray behind their feet. A springy sound will play as they jump and a boom will play as they crash, bursting in a cloud of smoke particles as they fall over.

## Customize an explosion particle

The first particle effect we should add is an explosion for when the player collides with an obstacle.

[Video](https://connect-mediagw.unity.com/h1/20241207/videos/4a607009-47a8-4b16-b13a-8db9f1bd5d67_CWC_U3.L4.S1_U6.mp4) ([Transcript (en)](https://storage.googleapis.com/learn-platform-bucket-production/tutorial/be624ec8-270c-4980-8d88-5d43b53b4c82/versions%5B_key==%2243f98a0c3170%22%5D.sections%5B_key==%22f5Dcpkp7DZC0QRMvpxe2fY%22%5D.body%5B_key==%22f5Dcpkp7DZC0QRMvpxe2le%22%5D.subtitles/CWC_U3.L4.S1_U6.mp4_20260505_044349.srt))

1. From the _Course_ _Library > Particles_, drag **FX_Explosion_Smoke** into the hierarchy, then use the **Play** / **Restart** / **Stop** buttons to preview it
2. Play around with the **settings** to get your **particle system** the way you want it
3. Make sure to **uncheck** the **Play on Awake** setting
4. Drag the **particle** onto your player to make it a **child object**, then position it relative to the player

## Play the particle on collision

We discovered the particle effects and found an explosion for the crash, but we need to assign it to the Player Controller and write some new code in order to play it.

[Video](https://connect-mediagw.unity.com/h1/20241207/videos/789157c9-92a8-482d-9d67-4eac4f789df3_CWC_U3.L4.S2_U6.mp4) ([Transcript (en)](https://storage.googleapis.com/learn-platform-bucket-production/tutorial/be624ec8-270c-4980-8d88-5d43b53b4c82/versions%5B_key==%2243f98a0c3170%22%5D.sections%5B_key==%22f5Dcpkp7DZC0QRMvpxe4F6%22%5D.body%5B_key==%22f5Dcpkp7DZC0QRMvpxe4LC%22%5D.subtitles/CWC_U3.L4.S2_U6.mp4_20260505_044409.srt))

1. In **PlayerController.cs**, declare a new **_public ParticleSystem explosionParticle;_**
2. In the Inspector, assign the **explosion** to the **explosion particle** variable
3. In the **if-statement** where the player collides with an obstacle, call **_explosionParticle.Play();_**, then test and tweak the **particle properties**

![](https://storage.googleapis.com/learn-platform-bucket-production/tutorial/be624ec8-270c-4980-8d88-5d43b53b4c82/versions%5B_key==%2243f98a0c3170%22%5D.sections%5B_key==%22f5Dcpkp7DZC0QRMvpxe4F6%22%5D.body%5B_key==%22f5Dcpkp7DZC0QRMvpxe5B1%22%5D.image/CWC_B.1.5_image1_20260421_003010.png)

## Add a dirt splatter particle

_The next particle effect we need is a dirt splatter, to make it seem like the player is kicking up ground as they sprint through the scene. The trick is that the particle should only play when the player is on the ground._

[Video](https://connect-mediagw.unity.com/h1/20241207/videos/9f854428-327e-477b-9097-0f8a02b9a504_CWC_U3.L4.S3_U6.mp4) ([Transcript (en)](https://storage.googleapis.com/learn-platform-bucket-production/tutorial/be624ec8-270c-4980-8d88-5d43b53b4c82/versions%5B_key==%2243f98a0c3170%22%5D.sections%5B_key==%22f5Dcpkp7DZC0QRMvpxe5E4%22%5D.body%5B_key==%22f5Dcpkp7DZC0QRMvpxe5KA%22%5D.subtitles/CWC_U3.L4.S3_U6.mp4_20260505_044426.srt))

1. Drag **FX_DirtSplatter** as the Player’s **child object**, reposition it, rotate it, and edit its settings
2. Declare a new  **_public ParticleSystem dirtParticle;_**, then **assign** it in the Inspector
3. Add **_dirtParticle.Stop();_** when the player jumps or collides with an **obstacle**
4. Add **_dirtParticle.Play();_** when the player lands on the **ground**

![](https://connect-mediagw.unity.com/h1/20241207/learn/images/36ce1f23-58db-4d85-8b1a-154074470290_image.png)

## Add music to the camera object

Our particle effects are looking good, so it’s time to move on to sounds! In order to add music, we need to attach sound component to the camera. After all, the camera is the eyes AND the ears of the scene.

[Video](https://connect-mediagw.unity.com/h1/20241207/videos/36a32bee-9903-40c1-8709-b1aee0fca741_CWC_U3.L4.S4_U6.mp4) ([Transcript (en)](https://storage.googleapis.com/learn-platform-bucket-production/tutorial/be624ec8-270c-4980-8d88-5d43b53b4c82/versions%5B_key==%2243f98a0c3170%22%5D.sections%5B_key==%22f5Dcpkp7DZC0QRMvpxe6MB%22%5D.body%5B_key==%22f5Dcpkp7DZC0QRMvpxe6SH%22%5D.subtitles/CWC_U3.L4.S4_U6.mp4_20260505_044442.srt))

1. Select the Main **Camera** object, then _Add Component > Audio Source_
2. From _Course_ _Library > Sound_, drag a **music clip** onto the **Audio Resource** variable in the inspector
3. Reduce the **volume** so it will be easier to hear **sound effects**
4. Check the **Loop** checkbox

## Declare variables for Audio Clips

Now that we’ve got some nice music playing, it’s time to add some sound effects. This time audio clips will emanate from the player, rather than the camera itself.

[Video](https://connect-mediagw.unity.com/h1/20241207/videos/9607ff46-0a15-400d-97d1-7f55a4208bcc_CWC_U3.L4.S5_U6.mp4) ([Transcript (en)](https://storage.googleapis.com/learn-platform-bucket-production/tutorial/be624ec8-270c-4980-8d88-5d43b53b4c82/versions%5B_key==%2243f98a0c3170%22%5D.sections%5B_key==%22f5Dcpkp7DZC0QRMvpxe7XL%22%5D.body%5B_key==%22f5Dcpkp7DZC0QRMvpxe7dR%22%5D.subtitles/CWC_U3.L4.S5_U6.mp4_20260505_044500.srt))

1. In **PlayerController.cs**, declare a new **_public AudioClip jumpSound;_** and a new **_public AudioClip crashSound;_**
2. From _Course Library > Sound_, drag a clip onto each new **sound** variable in the inspector

## Play Audio Clips on jump and crash

We’ve assigned audio clips to the jump and the crash in PlayerController. Now we need to play them at the right time, giving our game a full audio experience.

[Video](https://connect-mediagw.unity.com/h1/20241207/videos/5ead4a7e-a929-4c2e-b723-2d2e99332d6f_CWC_U3.L4.S6_U6.mp4) ([Transcript (en)](https://storage.googleapis.com/learn-platform-bucket-production/tutorial/be624ec8-270c-4980-8d88-5d43b53b4c82/versions%5B_key==%2243f98a0c3170%22%5D.sections%5B_key==%22f5Dcpkp7DZC0QRMvpxe8H4%22%5D.body%5B_key==%22f5Dcpkp7DZC0QRMvpxe8NA%22%5D.subtitles/CWC_U3.L4.S6_U6.mp4_20260505_044519.srt))

1. Add an **Audio Source** component to the **Player**
2. Declare a new **_private AudioSource playerAudio;_** and initialize it as **_playerAudio = GetComponent\<AudioSource>();_**
3. Call **_playerAudio.PlayOneShot(jumpSound, 1.0f);_** when the character **jumps**
4. Call **_playerAudio.PlayOneShot(crashSound, 1.0f);_** when the character **crashes**

![](https://connect-mediagw.unity.com/h1/20190522/learn/images/8dce2eeb-fa66-4dbc-b4e3-ad1d686ae17f_3_4_6.png)

## Lesson Recap

## New Functionality**:**

- Music plays during the game
- Particle effects at the player’s feet when they run
- Sound effects and explosion when the player hits an obstacle

## New Concepts and Skills**:**

- Particle systems
- Child object positioning
- Audio clips and Audio sources
- Play and stop sound effects

## Overall Recap**:**

We’ve made an incredibly polished game - we have these super cool sound and particle effects. We have upbeat background music. We learned how to utilize animations for our characters, and we did some programming magic to make our background endlessly scroll.

## Check your scripts:

PlayerController.cs

```csharp
using UnityEngine;
using UnityEngine.InputSystem;

public class PlayerController : MonoBehaviour
{
    public InputAction jumpAction;
    public float jumpForce = 10;
    public float gravityModifier;
    public bool isOnGround = true;
    public bool gameOver = false;
    public ParticleSystem explosionParticle;
    public ParticleSystem dirtParticle;
    public AudioClip jumpSound;
    public AudioClip crashSound;

    private Rigidbody playerRb;
    private Animator playerAnim;
    private AudioSource playerAudio;

    void Start()
    {
        playerRb = GetComponent<Rigidbody>();
        jumpAction.Enable();
        Physics.gravity *= gravityModifier;
        playerAnim = GetComponent<Animator>();
        playerAudio = GetComponent<AudioSource>();
    }

    void Update()
    {
        if (jumpAction.triggered && isOnGround && !gameOver)
        {
            playerRb.AddForce(Vector3.up * jumpForce, ForceMode.Impulse);
            isOnGround = false;
            playerAnim.SetTrigger("Jump_trig");
            dirtParticle.Stop();
            playerAudio.PlayOneShot(jumpSound, 1.0f);
        }
    }

    private void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.CompareTag("Ground"))
        {
            isOnGround = true;
            dirtParticle.Play();
        }
        else if (collision.gameObject.CompareTag("Obstacle"))
        {
            gameOver = true;
            Debug.Log("Game Over!");
            playerAnim.SetBool("Death_b", true);
            playerAnim.SetInteger("DeathType_int", 1);
            explosionParticle.Play();
            dirtParticle.Stop();
            playerAudio.PlayOneShot(crashSound, 1.0f);
        }
    }
}
```
