Aspect Ratio Fitter

The Aspect Ratio Fitter component works similarly to the Layout Element component, as it allows overriding the size constraints being sent to it. It will force the UI object on which it is attached to resize based on an aspect ratio.

To add an Aspect Ratio Fitter component to a UI object, select Add Component | Layout | Aspect Ratio Fitter (Script) from within the object's Inspector. The Aspect Ratio Fitter component has the following properties:

The Aspect Ratio property is the aspect ratio that the Rect Transform will maintain. If you want to do an aspect ratio like 4:3, you can simply enter 4/3 in the box, and it will ...

Get Mastering UI Development with Unity now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.