| 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
 | | using System.Collections; |  | using System.Collections.Generic; |  | using UnityEngine; |  | using UnityEngine.UI; |  |   |  | [ExecuteAlways] |  | public class FontSwitch : MonoBehaviour |  | { |  |     [SerializeField] FontType m_FontType = FontType.Preferred; |  |     public FontType fontType { get { return m_FontType; } set { m_FontType = value; } } |  |   |  |     Text m_Text; |  |     public Text text { get { return m_Text ?? (m_Text = this.GetComponent<Text>()); } } |  |   |  |     [ExecuteAlways] |  |     private void Awake() |  |     { |  |         switch (m_FontType) |  |         { |  |             case FontType.Preferred: |  |                 text.font = FontUtility.preferred; |  |                 break; |  |             case FontType.Secondary: |  |                 text.font = FontUtility.secondary; |  |                 break; |  |         } |  |     } |  |   |  |     public enum FontType |  |     { |  |         None, |  |         Preferred, |  |         Secondary |  |     } |  |   |  | } | 
 |