VR Development Framework
v 1.0.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
AVR_FA_GlyphHelper.cs
1 using System.Collections;
2 using System.Collections.Generic;
3 using UnityEngine;
4 using UnityEngine.UI;
5 using UnityEditor;
6 
7 /// <summary>
8 /// arc-vr-ui utils namespace
9 /// </summary>
10 namespace AVR.UI.Utils {
11  [ExecuteInEditMode]
12  [RequireComponent(typeof(Text))]
13  public class AVR_FA_GlyphHelper : MonoBehaviour
14  {
15  void Awake() {
16  if(!Application.isEditor) {
17  AVR.Core.AVR_DevConsole.cwarn("There is a redundant GlyphHelper object at: "+AVR.Core.Utils.Misc.GetHierarchyPath(transform)+". Consider removing it.", this);
18  GameObject.Destroy(this);
19  }
20  }
21 
22  public void setup(Font font, int unicode) {
23  Text t = GetComponent<Text>();
24  t.font = font;
25  t.text = ((char)unicode).ToString();
26 
27  #if UNITY_EDITOR
28  EditorUtility.SetDirty(gameObject);
29  #endif
30  }
31  }
32 }
void setup(Font font, int unicode)