Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Game Development How to Make a Video Game Pickups Add Pickup Particles

Won't stop repeating

Hey, I was just wondering why the particles tend to not go away after writing the Destroy method. Here is my code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PickupParticlesDestruction : MonoBehaviour {

    // Use this for initialization
    void Start () {
        // Destroy the "pickup particles" after 5 seconds
        Destroy (gameObject, 5f);
    }
}

EDIT: for some reason the code decided to not all show up in the box. As you can probably tell by now.

I had the same problem lol Make sure you make the code for the "Fly particles" Prefab and not the "Player Particles" Prefabs. just look at your prefabs more the likely you add the code to the wrong prefab.