how to resize the texture at runtime

how to re-size the texture at run time !.pls help me !regarding this

for example:i have imported texture size of 200200 when .while running game i need to change the size of the texture to 100100 .

give me suggestion to work on this

thanks in advance

How are you displaying your texture? As a game object or as a GUI?

add your texture as a gameobject and at the runtime change the scale value of this texture object…

im displaying my texture for game object.(part of a character body).!

its possible to fit on that game object .what size that game object has

If it’s on a game object, just set the scale to be half of what it originally was.

myScale = myObj.transform.localScale;
myScale /= 2;
myObj.transform.localScale = myScale;

I think you cannot change texture size at runtime.

Yes you can.

–Eric

4 Likes

This works in Standalone but not in Webplayer - right?

Nope, it works in the webplayer.

–Eric

2 Likes

Works fine now, thanks Eric!

Had a similar issue loading images from a phone gallery into app for an app gallery and this was a life saver spent a week trying to find out how to do this before finally stumbling upon this. Thanks a ton.

Someone give this man a medal.
I am working on an app with 3 layers of different resolutions. It was easy enough to display them one on top of another centered into GUI elements which stretch them, but then I spent days to figure out how to crop one of them in accordance to the aim made with the 2 others.
When I finaly found the correct solution this post came as a godsent for the final piece of the puzzle. I would have spent days and a lot of sanity to put all of this together correctly.
Deepest appreciation.