Skip to content

Aspect Ratio Calculator

Luke Mirman edited this page Sep 7, 2022 · 2 revisions

Aspect Ratio Calculator

The Aspect Ratio Calculator component can be added to canvas UI elements to update an attached Aspect Ratio Fitter's aspectRatio to fit the layout element's dimensions.

Usage

  1. In the canvas hierarchy add the Aspect Ratio Fitter and Aspect Ratio Calculator to the game object to fit. A. Note: The game object must have a layout element such as text, image, or other ILayoutElement component.
  2. When the layout element has been modified use the RecalculateAspect(); method to update the Aspect Ratio Fitter's aspectRatio value

Clone this wiki locally