Instantiate a particle system, probably a stupid question

hey guys,
new to unity and programming.

the function I want to realize is like:

click A(startpoint) , right click B(endpoint), instantiate a particle system from A to B.

its not finish, cause I know there are many logic problems here, can you guys give me some hint on how i can make this work?
also,why i can’t use startpoint to assign a value to flowClone.transform.position?

Thanks!

void connection()
{
    Vector3 startpoint;
    Vector3 endpoint;
    ParticleSystem flowClone;
    bool startpointget;
    bool endpointget;

    if (Input.GetMouseButton(0))
    {
        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;
        if (Physics.Raycast(ray, out hit))
        {
            startpoint = hit.collider.transform.position;
        }
    }

    if (Input.GetMouseButton(1))
    {
        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;
        if (Physics.Raycast(ray, out hit))
        {
           endpoint = hit.collider.transform.position;
        }
    }

    flowClone = Instantiate(flow, Vector3.zero, Quaternion.identity) as ParticleSystem;
   flowClone.transform.position = startpoint;

}

Hi ,
I’m not sure what your real question is , but you cannot instantiate a particle system variable ( atlas not to my knowledge) . if you want to instantiate a particleSystem you have to make a gameObject of it.
so instead of initializing : particleSystem FlowClone ; make a gameObject : Public Gameobject FlowClone;

assign the particle systemPrefab to the public gameObject variable in your inspector.
I was always learned that you can only instantiate gameObjects so this might do the trick.

Thanks, guy!

it works. Assigning a initial value at the first is also necessary.