- Home /
Question by
martygrof3708 · Jul 28, 2019 at 09:28 PM ·
scripting problemmaterialcolorruntimeparticlesystem
Why doesn't changing the particle's mateiral color during runtime work?
I am using LWRP. My particle systems are using a material with the LWRP/ParticlesLit shader.
When I try to change the material's color during runtime, the particle's color doesn't change.
I have tried both of these methods:
public void ChangeColorSolid()
{
cloudMat.color = Color.red;
for (int i=0; i<previousCloudTileObjects.Count; i++)
{
// Method 1
previousCloudTileObjects[i].GetComponent<ParticleSystemRenderer>().material.color = Color.red;
// Method 2
previousCloudTileObjects[i].GetComponent<ParticleSystemRenderer>().material = cloudMat;
}
}
Comment