I need to scale my GUI.Labels on my screen for any resolution. Thus I need the Labels to remain in the same position and scale according to the screen resolution. I tried various scripts and unity functions such as GUI.matrix but I still cannot solve my problem. Can someone point me out how I can achieve this please?
Below is my OnGUI method in which I want all items to scale to any resolution.
function OnGUI () {
GUI.skin = skin;
xpos = Camera.main.WorldToScreenPoint(Vector3(0,0,0)).x;
ypos = Camera.main.WorldToScreenPoint(Vector3(0,0,0)).y;
GUI.matrix = Matrix4x4.TRS (Vector3.zero, Quaternion.identity, Vector3(Screen.width / 1920.0, Screen.height / 1200.0, 1));
GUI.Label(Rect((xpos - 250),(ypos - 150),150,50), currentTime.ToString());
GUI.Label(Rect((xpos - 250),(ypos + 110),150,50), combo.ToString());
GUI.Label(Rect((xpos - 75),(ypos + 110),150,50), totalScore.ToString());
GUI.Label(Rect((xpos + 100),(ypos + 110),150,50), currentScore.ToString());
if (windowCheck)
GUI.Window(0, Rect((xpos - 150),(ypos - 100),300,200), ShowWindow, windowTexture);
}