unity粒子系统BUG?

时间:2018-08-26 10:27:07

标签: unity3d particle-system particles

我有一个启用了sizeOverLifeTime参数的粒子系统。当我尝试使用脚本发射粒子并更改其大小时,即使我禁用了脚本中的sizeOverLifeTime,它也无济于事。但是,如果从一开始就禁用了sizeOverLifeTime,则一切正常。 sizeOverLifeTime参数有什么问题?脚本:

public class Test : MonoBehaviour {
    public bool trigger;
    public ParticleSystem m_System;
    ParticleSystem.Particle[] m_Particles;
    // Use this for initialization
    void Start () {

    }

    // Update is called once per frame
    void Update () {
       if (Input.GetKeyDown("space"))
        {   
             var sizeOverLifeTime = m_System.sizeOverLifetime;
             sizeOverLifeTime.enabled = false;
             m_System.Clear();           
             m_System.Emit(2000);

             m_Particles = new ParticleSystem.Particle[2000];
             var particles = m_System.GetParticles(m_Particles);
             for (int i = 0; i < 1500; i++)
             {
                 m_Particles[i].angularVelocity = 0;
                 m_Particles[i].startSize = 10;
             }
            m_System.SetParticles(m_Particles, particles);
            m_System.Play();
        }

    }
}

0 个答案:

没有答案