The maximum number of particles in the central control granulation subsystem of Unity.
The particle system in Unity is easy to use. However, a problem occurs in the actual process: it is necessary to dynamically control the maximum number of particles a particle system component can produce. It can be seen that the doc is controlled by maxparticipant, but this open parameter is not actually available and can only be implemented in other ways.
Here we can achieve this by manually generating particles, that is, the Emit method in the particle system. The specific code is as follows:
public class ParticleSystemComp : MonoBehaviour{ParticleSystem mParticleSystem = null;int mMaxParticles = 0;public ing MaxParticles{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 to add an additional component for each participant system to update the original PS through this component. The update principle is to determine the number of particles currently active. If the number of particles is smaller than the specified maximum, several new particles will be regenerated for filling.
In addition, for performance considerations, internal Update operations can also be moved to FixedUpdate to reduce the number of updates, but there is no visual difference.
Currently, the particle system of Unity3D 35 is continuously launching by default. How can this problem be solved only once?
Change Rate to 0 in Emission, and then click the plus sign in Bursts.
Time is set to 0
Specify the maximum number of Particles you have set.
This will trigger the number of particles you set at one time.
The unity3d particle system can make any type of particles.
This word is too absolute. No engine can make any effect. U3D makes the vast majority of results.