- Home /
Changing a single element of sharedMesh.uv
Hi, I am trying to change the Value of a single element of sharedMesh.uv . Replacing the whole Array works just fine.
So the following works:
Vector2[] uvArray = new Vector2[n];
TileMap.GetComponent<MeshFilter>().sharedMesh.uv = uvArray;
However that replaces the whole sharedMesh.uv array when I really only need to update a small portion of it.
The following does not work (it gives not error but it just doesn't change the value)
TileMap.GetComponent<MeshFilter>().sharedMesh.uv[0] = new Vector2(0.5f,0.25f);
Neither does
TileMap.GetComponent<MeshFilter>().sharedMesh.uv[0].Set(0.5f,0.25f);
It's probably some very simple mistake I am making, would appreciate your help very much.
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613131528im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Voxel retexture problem 0 Answers
Scale mesh but keep original uv? 0 Answers
Modifing the Standard Shader (specular setup) and Multiple UV set. 1 Answer
Assigning UV Map to model at runtime 0 Answers