Hi,
I need to color the particles that emit from my Game Object. The Game Object has a prefab attached to it which have the size, min, max, etc. of all the particles. Their is also an Ellipsoid Particle Emitter as one of the components to the Game Object.
How can I loop through the array of particles to change them from white to red?
Below is not the entire code, but the most relevent.
public GameObject ParticlePrefab;
public static GameObject instantiated;
if (Input.GetKeyDown("h") instantiated == null)
{
instantiated = (GameObject) Instantiate(ParticlePrefab, transform.position, Quaternion.identity);
Particle[] p = particleEmitter.particles;
for (int i = 0; i < 20; i++)
{
p[i].color = Color.red;
}
}
What happens, is that whenever I press h on the keyboard, the particles emit as they should. I just want to loop through the particles that are instantiated when I press ‘h’ and change them from white to red.