Unity the particle system is very easy to use. Such a problem is encountered in the actual process: the maximum number of particles that can be produced in order to control the dynamic needs of the particle system components.
Look at Doc, he says, there's maxparticles control. But there is no such open parameter. Can only be done in other ways.
This can be achieved by manually generating particles. Also known as the Emit method in Particlesystem, detailed code such as the following:
public class Particlesystemcomp:monobehaviour{particlesystem Mparticlesystem = Null;int mmaxparticles = 0;public int max Particles{get{return Mmaxparticles;} Set{mmaxparticles = value;}} void Awake () {Mparticlesystem = This.gameobject.getcomponent<particlesystem> (); mparticlesystem.emissionrate = 0.0f;mmaxparticles = Mparticlesystem.particlecount;mparticlesystem.clear ();} void Update () {if (Mparticlesystem! = null) {if (Mparticlesystem.particlecount < mmaxparticles) {Mparticlesystem.emit (Mmaxparticles-mparticlesystem.particlecount);}}}
The implementation process is for each particlesystem to add an additional component to the original PS update through that component.
The update principle is to infer the number of particles currently active, assuming that the number of particles is less than the specified maximum value, and then generate several new particles to fill.
In addition For performance reasons. Operations inside the update can also be moved to Fixedupdate to reduce the number of updates. But it does not bring much difference in vision.
Copyright notice: This article Bo Master original articles, blogs, without consent, may not be reproduced.
Maximum number of particles in a Unity notes modulated particle system