当前位置:网站首页>Unity字体间距
Unity字体间距
2022-06-11 10:16:00 【龙胖胖的博客】
直接把代码放到Text上,调整Spacing就可以了
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class FontSpacing : BaseMeshEffect
{
public float spacing = 0;
public override void ModifyMesh(VertexHelper vh)
{
List<UIVertex> vertexs = new List<UIVertex>();
vh.GetUIVertexStream(vertexs);
int vertexIndexCount = vertexs.Count;
for (int i = 6; i < vertexIndexCount; i++)
{
UIVertex v = vertexs[i];
v.position += new Vector3(spacing * (i / 6), 0, 0);
vertexs[i] = v;
if (i % 6 <= 2)
{
vh.SetUIVertex(v, (i / 6) * 4 + i % 6);
}
if (i % 6 == 4)
{
vh.SetUIVertex(v, (i / 6) * 4 + i % 6 - 1);
}
}
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class FontSpacing : BaseMeshEffect
{
public float spacing = 0;
public override void ModifyMesh(VertexHelper vh)
{
List vertexs = new List();
vh.GetUIVertexStream(vertexs);
int vertexIndexCount = vertexs.Count;
for (int i = 6; i < vertexIndexCount; i++)
{
UIVertex v = vertexs[i];
v.position += new Vector3(spacing * (i / 6), 0, 0);
vertexs[i] = v;
if (i % 6 <= 2)
{
vh.SetUIVertex(v, (i / 6) * 4 + i % 6);
}
if (i % 6 == 4)
{
vh.SetUIVertex(v, (i / 6) * 4 + i % 6 - 1);
}
}
}
}
边栏推荐
猜你喜欢

DataGrip 2022,DataGrip 功能

Wechat applet ordering system with source code

ESP8266_ SNTP(Simple Network Time Protocol)

Correct opening method of RPC | understand go native net/rpc package

BCGControlBar库专业版,完整记录的MFC扩展类

B站到底能不能赚到钱?

Initial deployment of Servlet

Drink at night, 50 classic SQL questions, really fragrant~

Ugui picture wall

Secret behind the chart | explanation of technical indicators: tangqi'an channel
随机推荐
Ugui picture wall
MySQL permission management and backup
1. system in Library
穆格测试控制器的作用和应用场合有哪些
[torch]: parallel training and can dynamically set the batch size of the first GPU
DENISON液压泵用什么液压油?有哪些要求
Mysql--索引
ZigBee模块无线传输星形拓扑组网结构简介
EMG线性光源发射器有哪些功能和特点呢?
New feature of ES6 - arrow function
RSA signature issues
With determination to forge ahead, JASMINER continues to deepen its brand strength
远程工作时代的物联网安全
parker派克先导式电磁阀和直动式电磁阀的区别有哪些?
Excellent test engineer must have 4 safety test methods!
EMG执行器的作用和功能有哪些
Chemical composition of q355hr steel plate
利用PHP开发的一款万能、表白墙系统部分代码片段
Mysql--事务
外包干了四年,废了...