I have a rectangle mesh as a gameObject and I want to show a texture right in the middle of it, scaled as necessary with respect to its aspect ratio, but not cropped.
The way I started doing it is to create a new RenderTexture with an aspect ratio of my rectangle, and then I got tangled up in how to use the scale and offset arguments to Graphics.Blit() so the source texture (which can be of literally any dimensions and aspect ratio as it’s supplied by the app user) is blitted in its centre.
I can’t seem to wrap my mind around how scale and offset work.
Not really… would decals auto-scale in all cases (I’m interested in having the texture shown completely, even if it has an aspect ratio completely different from that of the rectangle mesh)?
Ok, I think I found a missing piece of the puzzle: according to some other answers on the forums, Graphics.Blit() always covers the entire destination texture… while I need something which will take a source texture, and scale it and blit it to only a rectangular area within the destination texture.