Image Size Fitter
A detailed guide on how to use the image fitter component.
Last updated
A detailed guide on how to use the image fitter component.
Last updated
This component automatically resizes the rect transform to fit the dimensions of the supplied image.
To use it you would simply need a gameobject with an image or image raw component on it, like this:
The rect transform's size is currently set at (100, 100). The sprite may be stretched if you add it to the source image field in the Image component because of the diffrence between the image's rect transform size and source image's dimensions. In doing so, the Image Size Fitter attempts to match both.
The source image is wide in dimensions, and the image's rect transform is cube shaped. Adding the component, "Image Size Fitter" to the image makes it fit.
By adjusting any of the x or y values of the delta size of the rect transform, this can update in real time and maintain the original shape of the image.