更改随时间变化速率乘数。
如果只想更改整体速率乘数,则此方法比访问整条曲线更加高效。
using UnityEngine;
using System.Collections;
public class ExampleClass : MonoBehaviour
{
private ParticleSystem ps;
public float hSliderValue = 5.0f;
void Start()
{
ps = GetComponent<ParticleSystem>();
}
void Update()
{
var emission = ps.emission;
emission.rateOverTimeMultiplier = hSliderValue;
}
void OnGUI()
{
hSliderValue = GUI.HorizontalSlider(new Rect(25, 45, 100, 30), hSliderValue, 5.0f, 200.0f);
}
}