当前位置:网站首页>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);
}
}
}
}
边栏推荐
- iPhone 15 被迫用上 Type-C 接口
- 启动jar
- Jmeter的使用(模拟高并发)
- ugui图片墙
- What are the differences between Parker pilot solenoid valve and direct acting solenoid valve?
- Browser class for getting started with puppeter
- 科技云报道:Web3.0浪潮下的隐私计算
- DOtween使用方法
- Mysql--索引
- Review handwritten questions in interview -- function interception and jitter
猜你喜欢

Reprint: linearlayout+fragment to achieve the lower navigation bar effect

Mysql-- index

Servlet 的初次部署

远程工作时代的物联网安全

EMG线性光源发射器有哪些功能和特点呢?

基于SSM+Vue+OSS的“依伴汉服”商城设计与开发(含源码+论文+ppt+数据库)

浅谈wandfluh比例阀的功能与作用

ugui图片墙

Q1's revenue exceeded Wall Street's expectations, and the value of Zhiwen group is waiting to return

UGUI
随机推荐
Chemical composition of q355hr steel plate
Leetcode brushing questions - hand tearing binary tree
Correct opening method of RPC | understand go native net/rpc package
面试复习之---闭包
Start jar
帝国CMS仿《游戏鸟》模板源码/92kaifa版大型手机游戏门户网站模板
Tree topology networking structure of ZigBee module communication protocol
ESP8266_ SNTP(Simple Network Time Protocol)
mysql基础学习笔记03
Knowledge drop - personality analysis - four types of method
iPhone 15 被迫用上 Type-C 接口
帝国CMS仿《手艺活》DIY手工制作网源码/92kaifa仿手艺活自适应手机版模板
ZigBee模块无线传输星形拓扑组网结构简介
UGUI
ugui图片墙
php 中使用exec显示报错
Cisp-pte XSS Foundation
对于力士乐电磁换向阀的功能与作用,你知道多少
Record yesterday's embarrassment
Function and function of wandfluh proportional valve