Camera scaling like in Editor game view
So currently I'm looking into building up a decent settings menu for my game and was wondering, is there any way to get a 'Scale' within scripting like in the game view?
What I mean by that is, if I change the resolution in the 'Game view' to 1920x1080 (Full HD) the scale is set to 0.5 and if I change the resolution to 3840x2160 (4K) the scale is set to 0.25. With 4K resolution scaled down, the game is looking (obviously) better.
So again, can I somehow get a reference for a build inside a script so if a player is starting the game with a 1080p monitor and then can 'scale' the game up/down (dynamically or manually)? Or even if the FPS drops under 30 the game could scale everything automatically?
Thanks in advance for any help/suggestions.