- Home /
how make texture not stretch and keep its ratio in a quad / plane ?
Hi, i need help about texture. i have texture which i get from server then apply to a quad. i need my texture to fit its container without stretching or tiling, it is possible to do this to texture ?
example:
this one is what i want,
not like this (stretched).
thank you,
please up vote if you guys what to know this too, i hope someone will notice this question
Answer by YiYiBaBa · Jan 21, 2019 at 06:59 AM
An easy way to do this is to create an Image and adjust it to the size that you like and set its opacity to 0 and then when you load the texture from the server you assign the Image to the Image that you created before and bring the opacity back.Or you can just make the new texture size equal to the size of the previous Image
thanks for reply,
note : the image that i want to display is varying depend on users, (actually it is a picture that i want to apply to a quad)
so i think i'll take the second method u mention. how to set the texture size to the previous image? is it you mean edit in photoshop?
O$$anonymous$$,If you want to set the size dynamically,you can look at the AIP for RectTransform.
hi YiYiBaBa, can you tell me more about what AIP is?
Answer by WainWork · Jan 23, 2019 at 08:25 AM
Are u using material or UI Image? If u using UI image, u can locate canvas in 3d world by canvas settings, and switch "native size" parameter on UI Image component
hi WainWork, as you can see on image i attached (above and below(in this comment) also) im using material attached to 3d object.
Your answer
![](https://koobas.hobune.stream/wayback/20220612190138im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Get Texture 2D after all shader passes are applied 0 Answers
Making texture cover whole button 1 Answer
Select part of the texture in GUI.DrawTexture 2 Answers
in game - how to partly invisible an object ? 2 Answers
Animating a Texture2D using cells 1 Answer