- Home /
UV Image Map Animation
I have a monospaced image of the numbers 0 to 9 and I need to map them to a group of square planes. The end result would be a score display of six planes with the numbers 0 - 9 mapped to each. I was planning on using the UV Animator extension from the Unity Wiki but its still down (Damn hackers)
I tried playing around with GetComponent().mesh.uv[x] = new Vector2(u,v) but I cant seem to figure it out.
Right now all the planes are set to 0 so I guess all I need to do is move the UVs to the right to change the number. If I could get one of the planes working I could easily do the rest. Each plane has 4 vertices.
Also, my scripts are in C# but answers in JS are ok if its easier for you.
Figured it out. Here is the answer.
$$anonymous$$esh mesh = GetComponent<$$anonymous$$eshFilter>().mesh; //get mesh
Vector2[] newUVs = mesh.uv; //get current uvs
for(int i=0; i< newUVs.Length; i++)
{
//modify uv coordinets here
newUVs[i].x +=.5f;//move uv coords to the right
}
mesh.uv = newUVs ;//apply to mesh
Answer by Ronin6 · Aug 10, 2012 at 11:55 AM
Figured it out. Here is the answer.
Mesh mesh = GetComponent<MeshFilter>().mesh; //get mesh
Vector2[] newUVs = mesh.uv; //get current uvs
for(int i=0; i< newUVs.Length; i++)
{
//modify uv coordinets here
newUVs[i].x +=.5f;//move uv coords to the right
}
mesh.uv = newUVs ;//apply to mesh
Your answer

Follow this Question
Related Questions
Normalizing mesh UVS? 1 Answer
Animated UVs dependent on joystick input - Scrolling BG 1 Answer
Can the animation editor create local rotational data? 3 Answers
creating a mesh and generating it's specific uvs 2 Answers
How to Generate flat uvs 1 Answer