Hi,
I’d like to move particles via script, by assigning velocity to each particle, but it doesn’t seem to work. I use standard Particle System (Game Object->Create Other->Particle System), and attach following script:
using UnityEngine;
using System.Collections;
public class ParticleMover: MonoBehaviour {
void Update()
{
ParticleEmitter emitter = (ParticleEmitter)GetComponent("ParticleEmitter");
for (int i = 0; i < emitter.particleCount; i++)
{
Particle p = emitter.particles[i];
p.velocity = Vector3.right * 2.0f;
emitter.particles[i] = p;
}
}
}
Nothing happens, the emitter works as if no script was attached to its object. I also tried with position with no luck. Is it possible to control each particle behavior via script?