change the number of particles in a system

hey

Can someone tell me how to have a variable which controls how many particles there are in a particle system. The lifetime of the particles I’m using is infinity I just want to be able to set how many particles there are.

thanks

You can change variables of particle system :

public ParticleSystem abc;    // drag your particle system here in inspector
int rate = 50;
int size = 1;
// In your function or Update

abc.emissionRate = rate;   // You can change rate variable according to your requirement
abc.startSize = size;      // You can change size variable according to your requirement

Old question but I found it on google.

ParticleSystem.Emit(int count) is what you’re looking for. Turn your emission rate to 0 and manually push the emit.