InputResizer.cs
475 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using UnityEngine;
using UnityEngine.UI;
public class InputResizer : MonoBehaviour {
protected void Start()
{
Text text = gameObject.GetComponent<Text>();
if (Screen.dpi < 140)
{
text.fontSize = 20;
}
// 240
else if (Screen.dpi < 280)
{
text.fontSize = 32;
}
// 320
else if (Screen.dpi < 400)
{
text.fontSize = 44;
}
// 480
else if (Screen.dpi < 500)
{
text.fontSize = 56;
}
else
{
text.fontSize = 56;
}
}
}