I'm working on a 2D project and I'm having a hard time figuring this out.
Currently I load images through an xml file, all of which are located in the StreamingAssets folder. Images are loaded (with a button click) in an image container.
The images can be landscape, portrait or even square, but I need to have the image always be 700px wide, and aligned to the top of the container (a UI Panel).
If I tick "Preserve Aspect", the images are not stretched, which is good, but instead they are fitted into my container, and this results in portrait images having space left and right, and landscape images having space above and below the image.
I have also tried the Rect Transform align tools, the layout components, the aspect ratio fitter and also the Rect Mask 2D.
Whatever I try, I simply cannot get my image aligned to the top and filled horizontally (700px wide the width of the image container).
If I need to tackle this in code, that's fine, but I have no idea where to start.
Any help is appreciated (...as I've been trying to get this right all day and haven't come up with a solution).
Currently I load images through an xml file, all of which are located in the StreamingAssets folder. Images are loaded (with a button click) in an image container.
The images can be landscape, portrait or even square, but I need to have the image always be 700px wide, and aligned to the top of the container (a UI Panel).
If I tick "Preserve Aspect", the images are not stretched, which is good, but instead they are fitted into my container, and this results in portrait images having space left and right, and landscape images having space above and below the image.
I have also tried the Rect Transform align tools, the layout components, the aspect ratio fitter and also the Rect Mask 2D.
Whatever I try, I simply cannot get my image aligned to the top and filled horizontally (700px wide the width of the image container).
If I need to tackle this in code, that's fine, but I have no idea where to start.
Any help is appreciated (...as I've been trying to get this right all day and haven't come up with a solution).