Creating a particle emissor via scripting. HELP

Hello everybody, how are you?
I’m new in this forum, nice to meet you :).

I have a question. I’m trying to create a particle emitter via scripting but I don’t know how to do it. In Unity3D interface is very easy to create an ellipsoidal particle emitter, but when I want to do the same by scripting I don’t know how to do it, and I’m getting really mad.

I’d like you to show me (I suppose 4 or 5 code lines), how to do it. I read that is possible that I could experiment problems to the time to implement an ellipsoidal particle emitter, in this case please show me how to implement a basic particle emissor, or any kind (by scripting).

Thank you very much and sorry for my english.
Nice to meet you again.

nobody? :slight_smile:

You do need some particle emitter connected to the object to have the actual particle system available. But switch off its “emit” property, so it doesn’t do anything, just provides a place for particles. Also, you need a ParticleRenderer attached to the object so the particles you emit are visible and optionally ParticleAnimator if you don’t want to animate particles yourself. To begin with - don’t add ParticleAnimator so particles you emit stay alive forever (for debugging).

after that something like:

var particles : Particle[ ] = new Particle;
for(var i= 0; i < size; ++i) {
particles*.position = …;*
particles*.color = …;*
particles*.energy = 1; // important - if set to zero particle will die even without Particle Animator*
particles*.size = …;*
// …
}
particleEmitter.particles = particles;