I’m trying to keep a texture (on a rope model) perfectly still through the texture scale when increasing its length, like this:
transform.localScale= new Vector3(1, ySize, 1); // increase length of rope
renderer.material.mainTextureScale= new Vector2(ySize, 1); // adjust scale such that it fits perfectly again
This sort of works, but the tiling is a bit off; as I increase ySize, the texture seems to “wander” across the rope instead of simply extending at one end.
The original scale of the rope in the y axis is 1, as is the dimension in Blender, and there is no import factor.
I believe it has to do with the way Unity handles uv tiling, where as Blender uses the “center” of a image to scale it, while Unity uses the edges. For example, if you have an image texture that is red in the center, blue at the edges, and green in between, then scaling it to 200% in Blender will stretch it so that the red part is twice as big (but still in the center), and the edges are now green. In Unity scaling to 200% will result in it stretching so that red part is in one of the corners, while the opposite sides are blue with green between them.
In the (admittedly crude) graphic of the example that I posted, the original is at the top, the Blender one is on the left, and the Unity one is on the right.