这里以阿里巴巴普惠体为例
下载字体后
在unity项目中Aseets/Fonts(如果没有这个目录则手动创建),把下载的字体拖到这个目录中
然后右键:创建>TextMeshPro>字体资产
创建成功后,如下图
项目中就可以正常使用中文了
项目中设置默认字体
编辑>项目设置>TextMesh Pro>设置>Deault Font Asset ,选中刚才添加的字体即可
常见问题汇总
1.部分字体展示正常,部分字体方框
如果报错信息提示:The character with Unicode value \u5170 was not found in the [AlibabaPuHuiTi-3-75-SemiBold SDF] font asset or any potential fallbacks. It was replaced by Unicode character \u25A1 in text object [ContinentLabel(Clone)].
调整Assets/Fonts,即创建好的文字资源的右侧检测器面板(Inspector),
Generation Settings>Atlas Width,Generation Settings>Atlas Height
这2个都设置为4096或者更大
Web前端(W3Cways.com) - Web前端学习之路


