Sprite lock w/h to constraints?

Is it possible to lock a sprite so that if you increase or decrease it’s size by width, then the height automatically adjusts too? And vice versa?

I can’t use scale in this case because I need to fit randomly sized sprites into a set width+height box and I don’t want to calculate out the scale each time.

I tried using Widget and locking Left+Right but then the height doesn’t adjust.

Maybe you can use the layout component and set the fit children to container option.

nah unfortunately it does a similar thing as widget where it compresses the image into the dimensions but doesn’t adjust the axes in ratio, just fits it into the cell size

I just wrote my own scaler using a parent node with the set width/height I needed as constraints and a child node that I loop through width + height to equally scale down both until neither is larger than the parent constraints.