How do i create multiple vertices from an object?

Hello, this is rather a simple question but i cant really understand on how to do it, i am trying to achieve something like this in Pic1, but the results i am getting are in Pic2. Does anyone know how to do this?

NOTE: there is a post on about this at this [site][1]

-Pic1.
[76521-capture27.png*|76521]
-Pic2.
[76522-capture26.png*
|76522]
Here is what my code so you know what i have done.

using UnityEngine;
using System.Collections;

public class Extruder : MonoBehaviour {

    public Mesh prefab;
    public int length;
    private Mesh mesh;

    private Vector3[] vertices;

    void Start()
    {

        vertices = prefab.vertices;
        Generate();
    }
	// Update is called once per frame
	void Generate () {

        vertices = new Vector3[(length)];
        for (int i = 0, x = 0; x <= length; i++, x++)
        {
            vertices *= new Vector3(0, 0, x);*

}
mesh.vertices = vertices;
}
private void OnDrawGizmos()
{
Gizmos.color = Color.black;
for (int i = 0; i < vertices.Length; i++)
{
Gizmos.DrawSphere(vertices*, 0.1f);*
}
}
}

@Bunny83 @Fattie
_[1]: c# - How do i create multiple vertices from an object? - Stack Overflow
_

_*

um - your problem is X and Y are always the same, in fact zero.

vertices *= new Vector3(0, 0, x);*

you are setting them to zero every time.
you want to weave FOUR points. something like this …
you have this:
vertices = new Vector3(0, 0, x);
you should have this:
vertices = new Vector3(-1, -1, x);
vertices = new Vector3(-1,1, x);
vertices = new Vector3(1, 1, x);
vertices = new Vector3(1, -1, x);
it is very common when you are weaving mesh that you have code like that: for each trip through the loop you may be making say 6, 8 or whatever points.
try to travel around anticlockwise if possible, just as a matter of style. note you will absolutely need to become expert at using gizmo balls during development if you are not using them already
(1) I would just point out that “generating mesh” is pretty difficult; you probably still have a ways to go and many other problems to solve
(2) this site answers.unity3d just works really poorly these days. for example I am never logged in, it seems to constantly log me out, and the site barely works and has many bugs. StackOverflow is incredibly lame and uncool, but there are nowadays huge numbers of Unity questions on there. I would probably encourage you to ask on there.
There are many superb essays by people both intelligent and witty on there, often sober too :slight_smile: example pls go here c# - Unity game manager. Script works only one time - Stack Overflow and vote it up. see you there