- Home /
Why are these objects there from the beginning?
Hello,
i've created some ParticleSystems and want to initiate them with some keys. To destroy these objects works fine, but i can't create them, because they are always in my gmae from the beginning. But non of my scripts call them? Here's a picture of my hierarchie: the two particle systems are "Smoke" and "flame"
Answer by duck · Dec 01, 2009 at 12:02 PM
I don't entirely understand your question, but if your goal is just to trigger some Smoke or Flame at certain moments in your game, it would probably be a better approach to toggle the .emit flag to true and false at those times, rather than actually create and destroy your particle system GameObjects.
You can keep the Particle System GameObject present in your scene the whole time. Just un-check 'emit' in the editor, and when you need some smoke or flame in your game, use scripting to set the position of the particle system, and set the .emit value to = true. Then, a few seconds later, set it back to false to stop the emitter.
If you want to trigger these emitters when a key is pressed, you'll need to use either Input.GetKey or Input.GetKeyUp. Click those links for the documentation.
hope this helps!
Thanks, this works fine: Smoke.particleEmitter.emit = true; But wouldn't this be bad for performance for bigger projects?
No, particle emitters are very well optimized. All the particles for a given emitter are drawn as if they were a single mesh, which is great for keeping your draw calls down.
Your answer
![](https://koobas.hobune.stream/wayback/20220613173455im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How would I create a particle field that moves and looks like Saturn's (planet) ring 1 Answer
Switching GameObject between static and non-static 2 Answers
SHADER: Get *object* position or distinct value per *object* 1 Answer
Manipilating particle size with respect to movement of my gameobject ? 0 Answers