How do I copy UV variables?
Vector2[] Floor = Mesh.uv;
If I use this line and change anything in the "Mesh.uv", then the "Floor" will also be changed. Do any of you know how to copy the Mesh.uv variables without having these two variables being "connected". Thanks!
Answer by dudester · Feb 14, 2016 at 12:54 AM
Vector2[]Floor = new Vector2[Mesh.uv.Length];
Vector2[]TempUv= Mesh.uv;
for(int i =0;i < Floor.Length;i++){
Floor[i] = TempUv[i];
}
The mesh.uv length is at 125^2. I should've mentioned that I originally tried your solution, but Unity instantly freezes when I try that. I found the answer thou! You need to create a dummy mesh, and add the UV to the dummy mesh, and from the dummy mesh you can get the UV.
Answer by Keseren · Feb 14, 2016 at 01:30 PM
Found it out. Had to create a mesh, then add the UV to the new mesh. Then to get the UV you have to use mesh.uv. Its complicated, but thats because the UV is a property, and not a variable.