Tanoda
PPIViewer.cs
Go to the documentation of this file.
1
3
4/*USAGE:
5Simply place the script on A Text control in the scene to display the current PPI / DPI of the screen*/
6
8{
9 [RequireComponent(typeof(Text))]
10 [AddComponentMenu("UI/Extensions/PPIViewer")]
11 public class PPIViewer : MonoBehaviour
12 {
13 private Text label;
14
15 void Awake()
16 {
17 label = GetComponent<Text>();
18 }
19
20 void Start()
21 {
22 if (label != null)
23 {
24 label.text = "PPI: " + Screen.dpi.ToString();
25 }
26 }
27 }
28}
Credit Erdener Gonenc - @PixelEnvision.