//错误写法
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);
}
面板中数值没有变,但实际执行效果已经修改
网友评论