Is it possible to have GUI keep it's position across all resolutions?


I just wanted to know if it’s possible, and if so, how. I tried researching it some, but the closest I got was using Screen.Height and Screen.Width(or something like that).

I was thinking that maybe I could somehow create my “own” coordinate system for the GUI, by using the screen height and width(kind of create a plane and place GUI on it). What that basically means is that I would make a new button at the position * screen height / screen width.

Basically, I want some GUI’s location to be persistent across all resolutions.

Would that method work? Or is it more complicated than that?

(Note: I didn’t actually try using the method I was talking about.)

Thank you,


You can go by a coordinate system where the number you put in the X,Y are part of the resolution scale but this often puts the GUI of people with 1080p and higher resolution scales awkwardly in the middle of the screen. Make sure all GUI script is in a OnGUI function. Here is an example of set resolution.


Now to keep everything the same you can make GUI that subtracts pixels from the total screen height and length to make it a little more compatible across different screen resolutions. Here is an example of that.


just make sure that whatever you put in the place of 50 is half of the number you put in 100 and same with 20 and 40.

Now im pretty sure there is no way to get you GUI exactly the same on every resolution but the second option is much closer and used more often by game makers.

I hope this helped you in some way or another and please leave me a comment if it didnt!

Yes, you can keep it in the same relative position across all resolutions.

The trick is what is called “normalized coordinates”. These are coordinates that are between 0 and 1 where 0,0 is one corner of the screen and 1,1 is the opposite corner.

You can get normalized coordinates by dividing the x and y pixel positions by the current width and height.

You then multiply the normalized coordinates times the actual width and height when the game sets up.

An equivalent thing to do is this:

  1. Lay your gui out with pixel coordinates at a well known resolution.
  2. Store that resolution along with the X and Y yo hare using for each gui element’s coordinates.
  3. When it comes time to draw, take the stored position coordinates, divide by the stored width and height, and multiply by the current width and height