# How can I map a processual cylinder network with a UV card? (Unit)

I have a script that generates a procedural cylinder.
Each side is a quad that consists of two triangles.
Since the two triangles have vertices, a page with two triangles is defined by 4 points.

The net produces a good result, as you see here:

However, I can not correctly assign the UV card.
My current progress has brought me here:

With a different texture you can see how it extends at certain points.
If the first quad is the "front" of the cylinder, these dots appear on each side.

I thought it would work to use the vertex data directly as UV points, but I can not make it work.

Here is the script.

private void _CreateSegmentSides ()
{
if (m_Sides> 2) {

float angleStep = 360.0f / (float) m_Sides;
Branch segment seg = new branch segment (m_NextID ++);
Quaternion rotation = quaternion.Euler (0.0f, angle step, 0.0f);
Float height = m_SegmentStartLength;
int max = m_sides - 1;
int index_tr = 0, index_tl = 3, index_br = 2, index_bl = 1;
Slip angle = 0f;

// Create first triangles.
seg.vertexes.Add (rotation * seg.vertexes[seg.vertexes.Count - 1]); // bottom right
seg.vertexes.Add (rotation * seg.vertexes[seg.vertexes.Count - 3]); // top left

// UV.
seg.uv.Add (rotation * seg.vertexes[seg.vertexes.Count - 4]);
seg.uv.Add (rotation * seg.vertexes[seg.vertexes.Count - 3]);
seg.uv.Add (rotation * seg.vertexes[seg.vertexes.Count - 2]);
seg.uv.Add (rotation * seg.vertexes[seg.vertexes.Count - 1]);

for (int i = 0; i <max; i ++)
{
Debug.Log ("add side (" + (i + 1) .ToString () + "/" + "max.ToString () +") Angle: "+ angle.ToString ());

// First triangle.
seg.vertexes.Add (rotation * seg.vertexes[seg.vertexes.Count - 2]);

seg.triangles.Add (seg.vertexes.Count - 1); // new vertex
seg.triangles.Add (seg.vertexes.Count - 2); // divided
seg.triangles.Add (seg.vertexes.Count - 3); // divided

seg.uv.Add (rotation * seg.vertexes[seg.vertexes.Count - 1]);

// Second triangle.
seg.vertexes.Add (rotation * seg.vertexes[seg.vertexes.Count - 2]);

seg.triangles.Add (seg.vertexes.Count - 3); // divided
seg.triangles.Add (seg.vertexes.Count - 2); // divided
seg.triangles.Add (seg.vertexes.Count - 1); // new vertex

seg.uv.Add (rotation * seg.vertexes[seg.vertexes.Count - 1]);

Angle + = angle step;
}