title: How to fix : "Do not create your own module instances, get them from a ParitcleSystem instance" when trying to loop a ParticleSystem by code
body: <p>I´m trying to start/stop the looping of a particle system by code, and when I did some google search I found that you could do it like this:</p>
  <pre><code>    [Header(&quot;Particles&quot;)]
      private ParticleSystem.MainModule particleSystemMain;
      private new ParticleSystem particleSystem;
      public GameObject particles;
  
      private void Start()
      {
          particleSystem = particles.GetComponent&lt;ParticleSystem&gt;();
          particleSystemMain = particleSystem.main;
      }
  
      public void ActivateParticles()
      {
          particleSystemMain.loop = true;
      }
  
      public void ParticlesFalse()
      {
          particleSystemMain.loop = false;
      }`
  </code></pre>
  <p>The problem is I am getting this error: <code>NullReferenceException: Do not create your own module instances, get them from a ParticleSystem instance UnityEngine.ParticleSystem+MainModule.set_loop (System.Boolean value)</code></p>
  <p>I am doing the looping part wrong?</p>