Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
ControlBoxScaler.cs
Go to the documentation of this file.
1using UnityEngine;
2using UnityEngine.UI;
3
5
6public class ControlBoxScaler : MonoBehaviour
7{
8 public Text[] textElements;
9
10 private Vector2 screenSize;
11
12 private void Start()
13 {
14 screenSize = new Vector2(Screen.width, Screen.height);
15 Text[] array = textElements;
16 for (int i = 0; i < array.Length; i++)
17 {
18 array[i].fontSize = Mathf.FloorToInt(Screen.height / 20);
19 }
20 }
21
22 private void Update()
23 {
24 if ((float)Screen.width != screenSize.x || (float)Screen.height != screenSize.y)
25 {
26 Text[] array = textElements;
27 for (int i = 0; i < array.Length; i++)
28 {
29 array[i].fontSize = Mathf.FloorToInt(Screen.height / 20);
30 }
31 screenSize = new Vector2(Screen.width, Screen.height);
32 }
33 }
34}