UMG, maintaining image aspect ratio

Hello everyone, I am working on some UMG right now, and I have an image that is the texture for my inventory. Currently I have the anchor set to be in the middle of the canvas, I like this because it maintains the image aspect ratio while also resizing itself based on the viewport size, the problem is that once I start to scale down my viewport to be too small, the image stops scaling itself down. A fix for this is to choose the anchor that encapsulates the whole canvas, the problem with this is that it does not maintain the image aspect ratio. Is there any way to combine these or set up custom anchor properties?

2 Likes

Not using the canvas, it knows nothing about images and aspect ratios, so it’s not really the job of the canvas. What you want is the ScaleBox, put the image in it, configure the relevant properties of scaling the contents accordingly.

5 Likes

Thanks! This solved my problem.