If I am using a set resolution, why are my GUI objects moving around?!

I am creating a 2d game and due to how I created the game, it seemed like the best choice was to just force a specific windowed resolution. My game runs at 1000 x 850 resolution. When you load the game, it uses the SetResolution function and puts it at 1000 x 850, regardless of what resolution you choose on the start manager. Sure, it’s not great, but it works for my game.

Here is the issue:
When sending my game to people, the GUI elements as well as what appears to be the camera, is out of place. I know there are ways to set the resolution to a certain ratio so your GUI elements are in the right spot regardless of resolution - but my game always runs at 1000 x 850!! I’m very frustrated and confused! After 7 months this is the last thing before my game is finished… grrrr!

Any help is greatly appreciated :smiley:

Hi!
Why did you choose that resolution? you should consider having a resolution that your graphics device and screen supports, because unity will choose the closest resoluion to one of these anyways.

Unity Reference to screen resolution setting

Try choosing for instance 1024 x 768 (quite low, but common enough, every screen and graphics device should be able to handle, also has a ratio of 4:3)

And when using gui elements which should fit for every resolution (too small will not work), try to get one good gui setting eg for 1024 x 768 and calculate the ratio.

If the people testing your game have a native resolution that is smaller (e.g. 1024x768) then the game view will be streched. But your GUI elements will still be rendered at the original screen coordinates.

1000x850 is not a standard resolution (4:3, 3:2, 16:10 or 16:9). I don’t think this is a good idea.

To get the resolution in script, use Screen.width and Screen.height. You can use these variables to choose the right position for your GUI elements, considering that (0,0) is the top-left corner and (Screen.width, Screen.height) is the bottom-right corner.