⚙️
FPS Framework
Asset StoreFab
  • Get Started
    • Welcome!
    • Setup
  • Tutorials
    • Character
      • First-Person Controller
      • Inventory
      • Firearm
        • Basics
        • Advanced
        • Other
          • Spray pattern
          • Attachment System
          • Projectile System
      • Explosive
    • Systems
      • Audio System
      • Animation System
      • Interactions
        • Pickable
      • Save System
      • Settings System
    • Tools
      • Extension Methods
    • UI
      • FPS Counter
      • Get Name
      • Image Size Fitter
  • Other
    • Full Change Log
      • 2025 Change Log
      • 2024 Change Log
      • 2023 Change Log
      • 2022 Change Log
Powered by GitBook
On this page

Was this helpful?

  1. Tutorials
  2. UI

Image Size Fitter

A detailed guide on how to use the image fitter component.

PreviousGet NameNextFull Change Log

Last updated 1 year ago

Was this helpful?

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.

Image's inspector
The image after fitting its size with its source image