# Texture scale doesn't alter

Hi all,

I am trying to map a texture onto a plane and regardless of the plane’s size/scale I wish the textured visible image to be the same.
For example if the plane is 100 x 100 (and for sake of argument) my texture ‘fills’ the entire area then
making the plane smaller (say 50,50) means I would only see part of the original texture but it wouldn’t be ‘scaled’ to fit the smaller mesh.
I’ve looked at settexturescale but can’t get the effect I want.

Any help appreciated

Cheers

you need to change the uv coordinates of the vertices of your mesh: Unity - Scripting API: Mesh.uv
so when you make the width of your plane half you apply 0.5 to the u coordinate of the mesh. so calculate the ratio independently for u and v and apply it.

Hey,

Ok, I am confused
I have my plane is space currently mapped to a texture (I don’t care about this texture as I am going to replace it with mine in a script)
If I don’t set texture scale I get rubbish drawn (though I am confused by how to use it).
So how do I remap my uv’s on this plane to my new texture? - do I need to do 1f/texture_size to remap them correctly?
Sorry bit lost

Cheers

i would say other way round. you have a texture mapped to the plane.

the example in the doculink gives you the method to change the uvs. the unity-plane seems to consist of 11 * 11 vertices. if you dont need that high resolution simply only add 4 vertices as corner of your plane. the upper right corner has the uv 0,0 and the lower right 1,1 (u equals x, v equals y). so you set these coordinates manually to the vertices of your plane. when you change the size of the plane (ingame?) you calculate the ratio of your current size to the reference size (u = 50.0f / 100.0f, v = 50.0f / 100.0f in your example). then you set the coordinates:
upper left vertex 0.0f, 0.0f
upper right vertex 0.5f, 0.0f
lower left vertex 0.0f, 0.5f
lower right vertex 0.5f, 0.5f
this way only the upper left quarter from your texture is displayed on your plane. if you use the unity texture you need to calculate the correct relative positions of the vertices inbetween.
hope that helps a bit.