Scale the Rect Transform components Scale Property x,y,z only Based on Resolution on buttons

Hello Unity Developers,

I am having trouble finding a Simple solution to my issue. i have researched for a couple days and I cannot figure out how i can change JUST the Scale property’s x,y,z of the Rect Transform Component on my buttons based on 2 different resolutions 1920 x 1200 or 1280 x 800 . So for example my buttons have all the same Scale dimensions. I want to say:
if aspect ratio of the device is 1920 x 1200 then all my buttons Rect Transform Scale x=8.89635, y=19.85735, z=19.85735
and
if aspect ratio of the device is 1200 x 1280 then all my buttons Rect Transform Scale x=8.89635, y=15.85735, z=15.85735

I do NOT need to change Height or width of the transform, JUST the Scale x,y,z, variables. I s there a simple way of writing this script and should I attach it to each button?

Sorry im New to Scripting. Thanks for any insight on how to do this.

design your layout for 1920

get ratio by using Screen.Width/1920

multiply scale and position by ratio

1 Like

Thanks but I’m not entirely sure how to do that.