How to center the score in screen?

Hello,

I put the score at upper center of the screen. Score is increased by players performance. What i want to do is, to center the score as far as it’s number. For example, if score is greater than 9 or 99 or 999, it should stay in the upper center of the screen. I centered it by 0. It goes right as far as it’s number. If it’s greater then 9, it goes right.

I could do that just like that;

    if(Score >= 10)
	{
		GUI.Label(new Rect(100, 10, 100, 20),"",skin.GetStyle("Score"));
	}

	if(Score >= 100)
	{
		GUI.Label(new Rect(90, 10, 100, 20), "",skin.GetStyle("Score"));
	}

	if(Score >= 1000)
	{
		GUI.Label(new Rect(80, 10, 100, 20), "",skin.GetStyle("Score"));
	}

but i didn’t want to do it like that. I was wondering that, if there is another way to do it briefly and to the point. It should stay in the top center all the time but how?

Use GUIStyle.CalcSize to calculate the size of content from your label and then re-draw it according to its size.