Anchor Presets doesn't have an option for keeping aspect

Hello, sorry if this topic is already in another question.
I have been playing around with the beta and I've found incredibly frustrating that you can set to stretch on width and or height but it seems there is no preset or way of having the image to adjust using it's aspect ratio, is there any way of doing this?

Hi UPMediaLab,
The Image component has property Preserve Aspect when Simple or Filled Image Type is selected.

Hi there,

I'm running into this issue too. Although there is indeed a "Preserve Aspect" option on Image components, I often find that I want that functionality built into the RectTransform itself, so that I can size something to the aspect ratio of my liking and then preserve that aspect ratio across all resolutions, but still have the objects scale to the height or width.

It seems the only way around this currently is writing a script that adjusts the RectTransform's SCALE based on the expected resolution.

It would also be nice to scale text based on this! (The "Best Fit" parameter on the Text component isn't sufficient, because sometimes I DON'T want it to have a "maxSize" and still don't want it to fill the text box!)

@ Unity devs, is there any chance of having this feature in the future?

1 Like

Bump in hopes that @runevision can answer. :) Apologies if this has been answered elsewhere, this was the closest thread I could find!

We don't have a good way of preserving aspect ratios for RectTransforms at the moment. It's possible to make a script that does it, but it's not currently compatible with the auto-layout system (e.g. layout groups), since it creates a circular dependency between widths and heights, at least if you want to be able to adjust the width based on the height, and not just the height based on the width.

I think ‘Keep Aspect Ratio’ functionality for RecTransforms would be very useful. If it’s possible to look into this, that would be great!

@[RV]CWolf @UPMediaLab @runevision
If anyone is still wondering about this, I found that the "Reference Resolution" component (which goes on the root canvas object) works for me, and does the same thing that UIRoot did in NGUI. I looked over this somehow when reading the docs!