- Home /
How to scale GUI.Label depending on the screen size?
Hi, i searched a lot how to resize/scale the "Score: " + score depending on the screen size, but still i don't know, could you help me please.
using UnityEngine; using System.Collections;
public class GameOverScript : MonoBehaviour {
int score = 0;
void Start () {
score = PlayerPrefs.GetInt ("Score");
}
void OnGUI ()
{
GUI.Label (new Rect(Screen.width / 2 - 40, 250, 80, 30), "Score: " + score);
}
}
the easiest way to use the new 4.6 ui and then the canvas scaler takes care of it for you. it's well worth switching... follow the tutorials for the new ui in the Learn section.
but how to put the script i need in one of those UI elements so it shows me the "Score "
Answer by Graham-Dunnett · Jan 04, 2015 at 05:15 PM
Read the docs about GUIStyle and use the version of GUI.Label which has 3 arguments.
Your answer
Follow this Question
Related Questions
Why is it working in JS but not C# 1 Answer
Big size after export from Xcode 1 Answer
Android APK size way too large 2 Answers
How to reduce apk size to its minimum? 6 Answers
change gameobjects size/scale acording to screen width? 0 Answers