,How to set the UV of the mesh?

I want to create a road through a c# script in Unity. I created a mesh like this.
alt text
The “vertetices” first adds the left and then the right points. Then set the UV the same order and value as “vertetices”. Then I got the following result. Figure 1 is the effect I generated, and Figure 2 is the effect I want. result
alt text
The road may be less regular, such as a turning situation, but my texture is square, how do I need to display the texture properly?

Your images are not that helpful without the code that is generating the mesh. Apart from that your vertex ordering seems very strange. Why don’t you go left-right-left-right as everybody else? That makes it way easier to setup the triangles and scales better if it should be longer.

You clearly messed up your uv coordinates. However the UVs have to be setup regarding to the vertices. Since we don’t know how you generate them we can not help you “fixing” your code.