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 trialMike McKnight
6,717 PointsDestroy fly pickup particle.
Just checking so I won't take unneeded time once I start developing my own game. He had us type out a destroy game object for the particle so it wouldn't continue going off every 5 seconds.
But correct me if i'm wrong, you can just go to the FlyParticles prefab, go to the inspector window and just uncheck loop. I did that with mine prior to typing the code and it seemed to work just fine.
1 Answer
Nicholas Rossi
5,066 PointsHi Mike,
I thought the same thing when I was doing this course, but then I realized why you destroy the particles. If you only uncheck the loop option, the instantiated particle game objects will still be in the scene at runtime, even if their animations are not playing. The idea is to keep the scene as free as possible from any clutter for performance and memory reasons. Just think what would happen if you ended up catching a bunch of flies, say 100 or so. You'd have over 100 instances of particle prefabs in the scene that wouldn't be doing anything.