Supporting Aspect Ratios from 4:3 to 16:9, but no more

Hey,

with the trend of new aspect ratios like Samsungs S8’s 18.5:9 I have to realize, that especially my UI heavy projects aren’t made for that and result in overlapping UI etc.
I’d like to just show black bars for all aspect ratios that are wider than 16:9 or higher than 4:3.

I tried to use the built-in Aspect Ratio Fitter, but it doesn’t really do the job for me, because it works in just one of these two limit directions (constraining either the width or the height by the opposite one) and so I didn’t make it work yet.

Is there a nice solution to this, or do I have to set scale of the canvas after detecting screen resolution or something like that?

Ok, I actually got it myself now.
First I get the aspect ratio of the device, then I check if it’s within my bounds and if it’s not, then I adjust the Camera Rect and the Canvas Scaler to shrink everything inside the remaining rect, not getting smaller than 4:3 or wider than 16:9.