- Home /
Changing the editor display aspect ratio/fixed resolution programmatically
I'm building a game that is displayed on both large widescreen-mode clients (think 16:9 HD resolution, like a TV or computer monitor) and small portrait-mode clients (mobile, 9:16-ish).
I have a very small scene manager built into our inspector tools, and I'd like it to fiddle with this setting automatically:
I've tried a few different approaches using both the Display and Camera classes, but none of them seem to have an effect on the display dimensions as understood by the camera preview and play mode resolution.
It would be even nicer if I could plug into the customization menu and automatically generate named aspect ratios ("Samsung Galaxy Note 5 is 16:9, iPhone 5S is..."), but I try not to dream too big.
One of the suggested questions StackExchange is giving me led me to the Screen reference, which I didn't know about until just now. It seems like the SetResolution()
method might be what I'm looking for, but I still haven't seen anything that is consistent with the "Aspect Ratio/Fixed Resolution" feature available in the GUI dropdown. Is the API just not there yet, or am I missing an even likelier suspect than Screen
?
I have the same problem. I believe SetResolution is just for the player, i.e. you can change the resolution of the PC screen but not the editor.