12 [Header(
"Text Mesh Settings")]
13 public TextAlignment Alignment = TextAlignment.Center;
14 public TextAnchor Anchor = TextAnchor.MiddleCenter;
15 public FontStyle Style = FontStyle.Normal;
17 public Color Color = Color.white;
23 [Header(
"Anchor Settings")]
25 public Vector3 AnchorLowerCenterOffset = Vector3.zero;
27 public Vector3 AnchorLowerLeftOffset = Vector3.zero;
29 public Vector3 AnchorLowerRightOffset = Vector3.zero;
31 public Vector3 AnchorMiddleCenterOffset = Vector3.zero;
33 public Vector3 AnchorMiddleLeftOffset = Vector3.zero;
35 public Vector3 AnchorMiddleRightOffset = Vector3.zero;
37 public Vector3 AnchorUpperCenterOffset = Vector3.zero;
39 public Vector3 AnchorUpperLeftOffset = Vector3.zero;
41 public Vector3 AnchorUpperRightOffset = Vector3.zero;
54 case TextAnchor.LowerCenter:
55 offset = AnchorLowerCenterOffset;
58 case TextAnchor.LowerLeft:
59 offset = AnchorLowerLeftOffset;
62 case TextAnchor.LowerRight:
63 offset = AnchorLowerRightOffset;
66 case TextAnchor.MiddleCenter:
67 offset = AnchorMiddleCenterOffset;
70 case TextAnchor.MiddleLeft:
71 offset = AnchorMiddleLeftOffset;
74 case TextAnchor.MiddleRight:
75 offset = AnchorMiddleRightOffset;
78 case TextAnchor.UpperCenter:
79 offset = AnchorUpperCenterOffset;
82 case TextAnchor.UpperLeft:
83 offset = AnchorUpperLeftOffset;
86 case TextAnchor.UpperRight:
87 offset = AnchorUpperRightOffset;
91 throw new ArgumentOutOfRangeException(
"anchor", anchor, null);
99 public class CustomEditor : ProfileInspector {
100 protected override void DrawCustomFooter() {
105 switch (textProfile.
Anchor) {
106 case TextAnchor.LowerCenter:
110 case TextAnchor.LowerLeft:
114 case TextAnchor.LowerRight:
118 case TextAnchor.MiddleCenter:
122 case TextAnchor.MiddleLeft:
126 case TextAnchor.MiddleRight:
130 case TextAnchor.UpperCenter:
134 case TextAnchor.UpperLeft:
138 case TextAnchor.UpperRight:
Vector3 AnchorUpperRightOffset
Vector3 AnchorUpperLeftOffset
Vector3 AnchorMiddleCenterOffset
Vector3 AnchorMiddleRightOffset
Vector3 AnchorLowerCenterOffset
Vector3 AnchorUpperCenterOffset
Vector3 AnchorLowerRightOffset
Vector3 GetOffset(TextAnchor anchor)
Convenience function for getting the offset from an anchor setting
Vector3 AnchorLowerLeftOffset
Vector3 AnchorMiddleLeftOffset