Difference between ParticleSystem.startColor and ParticleSystem.main.startColor

They produce vastly different results, the now obsolete version producing results that are preferred in my instance. I’d prefer not to use obsolete functions, but I then need to understand what has changed and why they produce different results.

I made a little project that spawns puffs with random start colours to show the difference:

Both are fed the same random Color variable using UnityEngine.Random.ColorHSV(), yet changing the obsolete startColor produces are more uniform grading.

I couldn’t find any documentation that gave any answer to why this is. Hopefully someone here can explain.

EDIT: Added more info.

GameObject p = Instantiate (puff, PlacementPosition (), Quaternion.identity) as GameObject;


var ps = p.GetComponent<ParticleSystem> ().main;
ps.startColor = UnityEngine.Random.ColorHSV();


p.GetComponent<ParticleSystem> ().startColor = UnityEngine.Random.ColorHSV();

The puff prefab has its property ‘Start Color’ set to ‘Random Between 2 Colors’.

If the prefab has its mode set to “random between 2 constants”, then the obsolete method is incapable of setting the property correctly. It can only set one of the colors.

The new property is able to set any mode, so when you set 1 color, it changes the mode.

When I said they were identical I presumed you were using the “single color” mode.

You can see what’s going on by looking at the inspector for the system after the script has run.

See: Unity - Scripting API: MinMaxGradient


They both set exactly the same property internally.
You would have to provide us with the script you wrote, to get a better answer.