public ParticleSystem.MainModule par;
private void Start()
{
par = GetComponent<ParticleSystem>().main;
}
public void SetColor(Color c)
{
{
par.startColor = c;
}
}
//在别的类中调用SetColor会报错,但是在别的类中直接写par.startColor = c;没事
//NullReferenceException: Do not create your own module instances, get them from a ParticleSystem instance
//UnityEngine.ParticleSystem+MainModule.set_startColor (MinMaxGradient value) (at C:/buildslave/unity/build/artifacts/generated/bindings_old/common/ParticleSystem/ParticleSystemBindings.gen.cs:50)
//可我就是想调用SetColor啊,怎么办嘞