Changing UV Coordinates does nothing ._.

Hi there…

I´m trying to change UV Coordinates of a Plane. This Plane has 960 Polygons. Means 480 Quads.
I managed to calculate the UV IDs of each by Script (see link below), so i´ve a List of all UVs and stored them in a serialized file.

Now, as next step, i tried to change the UV coordinates, so each Quad on my mesh shows the same 256*160 Part of my 4096² Texture (like all show the same tile of a tileset).
For this action, i created the “Set Null Room” Button. This Buttons runs a For-Loop, that changes all UV Coords of a quad inside the array to a hardcoded position.

The problem now:
Nothing happens… the model still looks the same after the button hit, then before… The Loop is running through all roms (0…479)…

Do i miss something? Is the UV changing not possible in Editor mode? Is C4D Format not possible to be changed?

My Editorscript (Editorfiller_TowerUVs.cs): Editorfiller_TowerUVs.cs - Pastebin.com

My guess is line 135 - 145
Although the docs do not explicitly state it, I think that a Mesh.uv retrieves a copy, so you can’t just edit in-place like you are.

//This will not work
someMesh.uv[0] = new Vector2(x,y);

//Must do this instead
Vector2[] uvs = someMesh.uv;
uvs[0] = new Vector2(x,y);
someMesh.uv = uvs;

At line 144 you are using mesh in place of sharedMesh. Just in case…