title: Instantiate and destroy GameObject/ParticleSystem
body: <p>I currently have a script that should Instantiate a particle system and destroy it after a certain amount of time, but after the object is Instantiated, this error code shows up:</p>
  
  <blockquote>
    <p>MissingReferenceException: The object of type 'ParticleSystem' has been 
        destroyed but you are still trying to access it.
        Your script should either check if it is null or you should not destroy the 
        object.</p>
  </blockquote>
  
  <p>the script is currently goes as such:</p>
  
  <pre><code>public class MuzzleFlash : MonoBehaviour {
  
      public Transform gun;
      public ParticleSystem smoke;
      public ParticleSystem flare;
      public ParticleSystem bullet;
      private float smokeTime = 0.2f;
  
      private void Update () {
          if (Input.GetButtonDown("Fire1"))
          {
              smokeFun();
              flare.Play();
              bullet.Play();
          }
      }
  
      void smokeFun()
      {
          Instantiate(smoke, gun);
          Destroy(smoke, smokeTime);
      }
  }
  </code></pre>
  
  <p>How can i Instantiate this particle system and destroy it properly?</p>