# Figuring out UVs for a circle mesh created by code

I’m trying to generate a circular mesh made up of triangles with a common center at the center of the circle.

I want the UVs to point outward, so that a moving shader applied to this will seem like it’s flowing from the center to the edges.
This already happens naturally on the sphere primitive, but I only need a flat surface without an underside.

I use this code to generate the mesh.
I thought the UV points would be similar to the vertexes, but I’m not getting any good results.

``````private void _MakeMesh(int sides, float radius = 0.5f)
{
m_LiquidMesh.Clear();
float angleStep = 360.0f / (float) sides;
List<Vector3> vertexes      = new List<Vector3>();
List<int>       triangles   = new List<int>();
List<Vector2>   uvs         = new List<Vector2>();
Quaternion      rotation  = Quaternion.Euler(0.0f, angleStep, 0.0f);

// Make first triangle.

// First UV ??

for (int i = 0; i < sides - 1; i++)
{

// UV ??

}
m_LiquidMesh.vertices   = vertexes.ToArray();
m_LiquidMesh.triangles  = triangles.ToArray();
m_LiquidMesh.uv         = uvs.ToArray();

m_LiquidMesh.RecalculateNormals();
m_LiquidMesh.RecalculateBounds();
}
``````

Please, where am I going wrong with this?

This is an old post, but maybe someone else will benefit from my solution.

So basically I gave my center point the center of the uv (0.5, 0.5) and then used the used circle formula to give every other point the uv coordinate. But of course I had to remap the cos and sin results from -1…1 to 0…1 and everything is working great.

``````    Vector2[] uv = new Vector2[vertices.Length];
uv[uv.Length - 1] = new Vector2(0.5f, 0.5f);

for (int i = 0; i < uv.Length - 1; i++)
{
float radians = (float) i / (uv.Length - 1) * 2 * Mathf.PI;
• ``````  }*
• ``````  mesh.uv = uv;*