Hello Everyone,

I am currently working on a series of GUIs for my game, and I have come across a strange error.

I have all my GUI buttons on Screen.width/#, etc, so that they change correctly for different screen resolutions, but the texts that are on the buttons do not.

Is there anyway to fix this? Any help would be greatly appreciated.

Here is how I am writing it. (the rest of the script is pretty much just repeats of this.

if(GUI.Button(Rect(Screen.width/2.5,Screen.height/2,Screen.width/10,Screen.height/20), "Cancel Quest"))
	        {
		            {
					questNumber.questNumber = 0;
					questNumLooking =0;
					questSelected = false;
					checkingQuest = false;
					drawGUI = true;
					}
				}
			}

Of course, font size don’t change. Simple solution: create new GUIStyle in Inspector and change font size in Start(). Or for your case best of all the following code will approach. For example, you have LandScape orientation and for the size screen 1920 the size of the text is equal 40. Then:

 public GUIStyle myStyleBtn = null; //reference on your style for button

 void Start() {
  myStyleBtn.fontSize = (int)(40.0f * (float)(Screen.width)/1920.0f); //scale size font
  //or you can create style in program
 }

 void OnGUI() {
  //and use style for your button
  if(GUI.Button(Rect(Screen.width/2.5,Screen.height/2,Screen.width/10,Screen.height/20), "Cancel Quest", myStyleBtn)) {
   //...
  }
 }

Probably, it is better for you to use GUI.matrix for scaling of all GUI elements. Or update Unity and use new UI. I hope that it will help you.