# How to use Particle start color in unity3d 2017

I want to create a particle(prefab) and use another object color to change those particle's color but it seems everything is changed and I don't know the new method to use it.

Here my code:

 GameObject breakpart = Instantiate (smoke, gameObject.transform.position , Quaternion.identity) as GameObject;

breakpart.GetComponent<ParticleSystem>().startColor = gameObject.GetComponent<SpriteRenderer>().color;


So how can I fix it?

Set the startColor property:
var ps = breakpart.GetComponent<ParticleSystem>();