How do I build a GUI that works on different sized screens?

I’ve been struggling getting Guitext /Guitextures to scale to screen (both for different PC monitors as well as Android Phone Sizes). Could someone please explain to me step by step (or point me to previously made instructions) the basics of building a GUI that works on different screen sizes/aspect ratios.

Try this Screen.width/2, Screen.height/2, Screen.width, Screen.height), “Words”);

Screen.width measures the width of the screen, and Screen.height does the same but with the height.

for the position, id Screen.width/2 to position it in the center. and the size i just use Screen.width to measure the width and set the size to that.

I’m also a newbie and what I did is I set up an original resolution and used the method here about modifying GUI matrix. Once your settled, draw the GUI’s in fixed positions like:

GUI.Box(new Rect(10,10,100,50), "Hey!");

And it will be scaled depending on the GUI matrix if the resolution changed. I think resizing your Game View window to the closest size of your original resolution helps, because it worked for me.

EDIT: SIDE NOTE OnGUI and GUITexture/GUIText are two different Unity GUI Systems.

You have to calculate your rect by using “Screen.width” and “Screen.height”