Issue with setting the color of a Particle System to color of respective GameObject

Hello,

I created a Prefab Smoke PS that has a default color of white. I want to use it on three different GameObjects, each one of them with a different color. When the GameObject gets destroyed, I want the PS to show up where the GameObject was - in the color of the now vanished object. The tutorial series I follow uses an older version of Unity, and the way it was done there does not seem to work anymore. The positioning of the PS works perfectly fine, but I can’t seem to find a way to change the color of the PS. Can you guys help me out?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;


public class Brick : MonoBehaviour {


    public GameObject Smoke;

    private int timesHit = 0;
    private int maxHits;
    private bool isBreakable;

    public static int breakableCount = 0;

[...]


        void OnCollisionEnter2D (Collision2D brickHit){
            if (isBreakable) {
            timesHit++;
            if (timesHit >= maxHits) {

                GameObject smokePuff = Instantiate (Smoke, this.transform.position, Quaternion.identity) as GameObject;
                smokePuff.GetComponent<ParticleSystem> ().main.startColor = this.GetComponent<SpriteRenderer> ().color;
                DestroyObject (gameObject);   
                breakableCount--;


            }

It returns this Error messsage:

Thank you so much for your time.

I figured it out, this is the way to do it if anyone is interested:

ParticleSystem.MainModule settings = Smoke.GetComponent<ParticleSystem> ().main;
                Instantiate (Smoke, this.transform.position, Quaternion.identity);
                settings.startColor = this.GetComponent<SpriteRenderer> ().color;