One image - many sprites with different aspect ratios

Hi,

I have an UI.Image element and I would like to load Sprites as source during runtime. Since I already figured out how to load the sprites, I have another more complex issue.

The sprites I load have different aspect ratios, like (214px x 62 px) and (150px x 172 px) and so on. I try to handle them with an Aspect Ratio Fitter, width controls height. But some sprites are very big and some very small, so that’s not really convenient for the user. How would I approach this topic to make it look neat?

Thanks for your help!

Easiest way would be to use a photo editor program or tool to change the size of all your images to be the same.

Alternatively, you could also control it by script, with a public “width” and “height” to follow by, change your sprite, and then set the bounds (width and height) of your sprite to be your public variables, which should essentially, achieve what you are going for, but will follow its own issues of possibly looking like crap (for example, if you are trying to fit a 300 x 500 image in a 100 x 100, it has to essentially squish 400 pixels of height into 100, and 200 pixels of width into 100 as well…,)