- Home /
Change gameview ratio / resolution using a custom inspector?
Hi, I'm trying to switch the gameview resolution (ratio) through a custom instpector, but I'm not having much luck. I can't seem to wrap my head around how to access the list of gameview resolutions. Is there a simple way to get this list?
Answer by Muhammad Salman · May 27, 2016 at 07:18 AM
Try this one and you can add any resolution you want but click on the (+) button on the button left corner of the pop up.
That's what I am trying to avoid doing, so that I can speed up the work flow.
$$anonymous$$y project will be used on computers with 2 displays with different resolutions, and there will be 6 configurations in all. Due to the dual monitor functionality being broken in unity (especially in linux, which is my target platform), I have to run the game in a wide window that will cover both displays.
One display will be for the game, and the other for the UI on a touch screen.
Since there are 6 configurations in all ( a mix of 16:10 and 4:3), I have to adjust the width, height, and positioning of both cameras (camera viewport rect) in the scene, as well as switch the gameview to match the proper ratio of those views. IE: 1024x768 + 1920x1200 will need a window size of 2944x1200 where 1366x768 + 1600x1200 will need a window of 2996x1200
I have created a custom inspector to change the camera viewports depending on the configuration, but I couldn't figure out how to switch the Gameview mode in the editor. (I want to have it all in 1 button to speed up work flow)
I found this thread: http://answers.unity3d.com/questions/956123/add-and-select-game-view-resolution.html Which does what I want, but I couldn't get this code working in my custom inspector.
$$anonymous$$y solution, is to use that script (with some modifications ) and call the function that adjusts the Editor Gameview from my custom inspector.
Thanks anyway!