CharacterSize









How do I use Character Size
Below are practical examples compiled from projects for learning and reference purposes

Featured Snippets

Line Code Ex..
44 if (this.CharacterSize > 0) 1

File name: ShowInfoOfPlayer.cs Copy
20     void Start()
21     {
22         if (font == null)
23         {
24             #if UNITY_3_5
25             font = (Font)FindObjectsOfTypeIncludingAssets(typeof(Font))[0];
26             #else
27             font = (Font)Resources.FindObjectsOfTypeAll(typeof(Font))[0];
28             #endif
29             Debug.LogWarning("No font defined. Found font: " + font);
30         }
31
32         if (tm == null)
33         {
34             textGo = new GameObject("3d text");
35             //textGo.transform.localScale = new Vector3(0.2f, 0.2f, 0.2f);
36             textGo.transform.parent = this.gameObject.transform;
37             textGo.transform.localPosition = Vector3.zero;
38
39             MeshRenderer mr = textGo.AddComponent();
40             mr.material = font.material;
41             tm = textGo.AddComponent();
42             tm.font = font;
43             tm.anchor = TextAnchor.MiddleCenter;
44             if (this.CharacterSize > 0)
45             {
46                 tm.characterSize = this.CharacterSize;
47             }
48         }
49     }

CharacterSize 98 lượt xem

Gõ tìm kiếm nhanh...