Accessing Shuriken particle system values through a script in C#

Hello,
I have massive problems accessing a particle system through a script.

What I want:
a particle system that spawns particles continuously which then go in a line to the right. When dragging a GUI slider the speed or the size of the particles should change.

What I have:
GUI slider is no problem,I also managed to create the particle system in the scene and it looks fine with the settings I gave it in the instructor. I called this particle system ‘Spawner’. I also created a C# script called ‘mosfetlogic’ which I use to show the GUI slider and which should access the particle system.
But this is where I get stuck and I cannot seem to find any useful tutorial/example to access it.

I do not need to access each particle on its own, just the basic values that I can change in the instructor. Right now I am really confused from all the different examples that I tried and didn’t work so I don’t even know where to start with the particle system.

Please help me if you have any clue, I am going crazy over this.

This is the code I have now, I want to use val to change values in the particle system:

using UnityEngine;
using System.Collections;

public class mosfetlogic : MonoBehaviour {
    private float val, tVal, bVal;
    private Rect rect = new Rect(25, 25, 10, 300);

    // Use this for initialization
    void Start () {
        val = 1.0F;
        tVal = 3.0F;
        bVal = 0F;	
    }
		
    void OnGUI(){                                   
        val = GUI.VerticalSlider(rect, val, tVal, bVal);                  
    }	
}

You need access to the particle System component. There is a property particleSystem (does it works ?) or GetComponent. Then, here are all the var you can access.

Thank you very much but the problem is that I don’t know how to access it. All I need would be an example code on how to change one of the values :S

In any script that is attached to the same GameObject as your shuriken, you can call transform.particleSystem for a shortcut. Then You can use particleSystem.GetParticles() and particleSystem.SetParticles(). Be warned though that the latter WILL cause a bug where your Shuriken will only render when its emitter is in view of the camera, thus causing individual particles to be culled while still in view.

class MyClass : MonoBehaviour{

ParticlesSystem shuriken;


void Start()
{
   shuriken = particleSystem;
   SetParticlesToFormALine();
}

void SetParticlesToFormALine()
{
   ParticleSystem.Particle[] particles = new ParticleSystem.Particle[8];
   for(int particleCount = 0; particleCount  < 8; particleCount ++)
          {
          particles[particleCount ] = new ParticleSystem.Particle();
          particles[particleCount ].position = Vector3.right*i;
          particles[particleCount ].color = Color.White;
          particles[particleCount ].size = 1f;

          }

         shuriken.SetParticles(particles,particleCount);

}

}

a very good tutorial on scripting shuriken:
http://catlikecoding.com/unity/tutorials/graphs/

the culling bug: