H A*_*fai 0 c# fonts unity-game-engine
我试图通过C#脚本实时更改字体.它在检查器中更改,但文本网格看起来像混合.
当我暂停并更改为另一种字体并返回到所需的字体时,它看起来很好.
那么我该如何解决这个问题呢?
这是一个错误吗?
编辑
这是我的代码:
public TextMesh text;
void Awake()
{
en_font = Resources.Load<Font>(“font Name”);
text.font = en_font;
}
Run Code Online (Sandbox Code Playgroud)
试试此代码:
Font ArialFont = (Font)Resources.GetBuiltinResource (typeof(Font), "Arial.ttf");
textMesh.font = ArialFont;
textMesh.renderer.sharedMaterial = ArialFont.material;
Run Code Online (Sandbox Code Playgroud)