UGUI Text 重写Spacing字体间距
using UnityEngine; using UnityEngine.UI; [AddComponentMenu("UI/Effect/UGUITextSpacing")] [RequireComponent(typeof(UnityEngine.UI.Text))]//Text组件是必须的 public class UGUITextSpacing : BaseMeshEffect { public enum HorizontalAligmentType { Left, Center, Right } public float fSpacing = 1.0f; public override void ModifyMesh(VertexHelper vh) { //一个文字有4个顶点 4个顶点组成两个三角面 如果顶点少于4个 说明text内容为空 就没必要去做字间距调整了 if (!IsActive() || vh.currentVertCount(图片来源网络,侵删)
文章版权声明:除非注明,否则均为主机测评原创文章,转载或复制请以超链接形式并注明出处。