MiddleCenter
How do I use Middle Center
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
File name: PhotonGUI.cs
Copy
69 {
70 get
71 {
72 if( m_DefaultRemoveButtonStyle == null )
73 {
74 m_DefaultRemoveButtonStyle = new GUIStyle();
75 m_DefaultRemoveButtonStyle.fixedWidth = 30;
76 m_DefaultRemoveButtonStyle.fixedHeight = 20;
77 m_DefaultRemoveButtonStyle.active.background = ReorderableListResources.CreatePixelTexture( "Dark Pixel (List GUI)", new Color32( 18, 18, 18, 255 ) );
78 m_DefaultRemoveButtonStyle.imagePosition = ImagePosition.ImageOnly;
79 m_DefaultRemoveButtonStyle.alignment = TextAnchor.MiddleCenter;
80 }
81
82 return m_DefaultRemoveButtonStyle;
83 }
84 }
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 }
File name: FlowLayoutGroup.cs
Copy
53 {
54 get
55 {
56 return childAlignment == TextAnchor.LowerCenter || childAlignment == TextAnchor.MiddleCenter ||
57 childAlignment == TextAnchor.UpperCenter;
58 }
59 }
File name: FlowLayoutGroup.cs
Copy
71 {
72 get
73 {
74 return childAlignment == TextAnchor.MiddleLeft || childAlignment == TextAnchor.MiddleRight ||
75 childAlignment == TextAnchor.MiddleCenter;
76 }
77 }
MiddleCenter 115 lượt xem
Gõ tìm kiếm nhanh...