The maximum number of particles in the central control granulation subsystem of Unity.

Source: Internet
Author: User
Tags emit

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.
 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.