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 * (new Vector3 (m_Radius, height, 0f))); // top right
seg.vertexes.Add (rotation * (new Vector3 (m_Radius, 0f, 0f))); // bottom left
seg.vertexes.Add (rotation * seg.vertexes[seg.vertexes.Count - 1]); // bottom right
seg.vertexes.Add (rotation * seg.vertexes[seg.vertexes.Count - 3]); // top left
// add triangle indices.
seg.triangles.add (index_tr); // 0
seg.triangles.add (index_bl); // 1
seg.triangles.add (index_br); // 2
seg.triangles.add (index_tr); // 0
seg.triangles.add (index_br); // 2
seg.triangles.Add (index_tl); // 3
// 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;
}
m_Segments.Add (seg);
}
}
```

I've been there all day, what's going wrong here?