//錯誤寫法
void SetEmissionRate (GameObject pGo, float pValue)
{
ParticleSystem tParticleSystem = pGo.GetComponentInChildren<ParticleSystem> ();
tParticleSystem.emission.rate = new ParticleSystem.MinMaxCurve (pValue);
}
上述寫法編譯報錯。
//正確寫法
void SetEmissionRate (GameObject pGo, float pValue)
{
ParticleSystem tParticleSystem = pGo.GetComponentInChildren<ParticleSystem> ();
ParticleSystem.EmissionModule emission = tParticleSystem.emission;
emission.rate = new ParticleSystem.MinMaxCurve (pValue);
}
面板中數(shù)值沒有變何吝,但實際執(zhí)行效果已經(jīng)修改