- <span style="font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);">1、直接改变particleSystem.startSpeed;这种方法简单,但是只能改变新产生的粒子的开始速度,已经存在的粒子速度不会发生改变</span>
2、修改Velocity over Lifetime,但是Unity并没有提供直接修改Velocity over Lifetime的方法,我们需要手动修改每个存在的粒子的速度。
- oid LateUpdate ()
- {
- ParticleSystem.Particle[] particles = new ParticleSystem.Particle[particleSystem.particleCount];
- int count = particleSystem.GetParticles(particles);
- for(int i = 0; i < count; i++)
- {
- particles[i].velocity = new Vector3(0, speed, 0);
- }
- particleSystem.SetParticles(particles, count);
- }