- Home /
Particle emitter to emit onto different mesh(position)
I dynamically clone a lot of Mesh Partical Emitter gameobjects, layouting them to specific positions (in the top of quads as the first picture shows.) at runtime. However I have to destroy them when each emitter object's duration is over. Is there a way to accomplish this without instantiating and destroying them so frequently ?
The process is like this :
in my scene, put a sphere added a mesh particle emitter as my clone base
disable its emitter on Start() in the script
clone and enable emitter(the new one) on demand
thanks ~
Answer by dorpeleg · Jul 15, 2013 at 01:43 PM
Either use .SetActive(true/false).
Or use any of the particle system function ParticleSystem (Shuriken).
If you are using legacy, see this ParticleEmitter.
All the functions will be used to turn the particles on and off.
If you wish to really destroy them, there is no other way then to use instantiating and destroying.
yes, I'm using lagacy. as u can see in the picture, the area to emit particle is not regular, that's why I choose to create a small size object with a emitter in a small square. Therefore my idea of solution is to copy these emitters to each square I want.
If you can have all the square full with particle during your game, then I think it will be best to place them upfront and just turn them on and off as you need to (no instantiating and destroying).
If there is a limited amount of particles (only up to 8 for example), then only create the max amount upfront and re-position them to where you need during run-time (again, no instantiating and destroying).
well, though I couldn't make sure how large the gird will be, I still will think about those ways, thanks.
If all your grid section will have particles, then the amount does not mater.
If you are generating your grid at run-time (random size each time) and can't place the particles upfront, then use a loop to instantiate the right amount of particles in the right locations.
But, do this only once, once that is done, only turn on/off your particles when needed.
Do not use destroy and instantiate if you can avoid it.
If this helped you, please mark the question as answered.
thanks, u gave me a lot of choices to do and think. I'll choice the suitable one on depends.