如何更改 VerticalLayoutGroup 显示的文本?
how to change text displayed by VerticalLayoutGroup?
我有一个位于屏幕右上角的文本,使用 VerticalLayoutGroup
。
static TextMeshProUGUI CreateText(Transform parent)
{
var go = new GameObject();
go.transform.parent = parent;
var text = go.AddComponent<TextMeshProUGUI>();
text.fontSize = 15;
return text;
}
不知是否可以更改这段文字的字体?我试过了:
Font ArialFont = (Font)Resources.GetBuiltinResource(typeof(Font), "LemonTea.ttf");
但没用。请帮忙
好了:)
这是更改 Textmeshpro 字体的方法
public TextMeshProUGUI textToChange;
public TMP_FontAsset FontAssetA;
// Start is called before the first frame update
void Start()
{
// Assign the new font asset.
textToChange.font = FontAssetA;
}
我有一个位于屏幕右上角的文本,使用 VerticalLayoutGroup
。
static TextMeshProUGUI CreateText(Transform parent)
{
var go = new GameObject();
go.transform.parent = parent;
var text = go.AddComponent<TextMeshProUGUI>();
text.fontSize = 15;
return text;
}
不知是否可以更改这段文字的字体?我试过了:
Font ArialFont = (Font)Resources.GetBuiltinResource(typeof(Font), "LemonTea.ttf");
但没用。请帮忙
好了:)
这是更改 Textmeshpro 字体的方法
public TextMeshProUGUI textToChange;
public TMP_FontAsset FontAssetA;
// Start is called before the first frame update
void Start()
{
// Assign the new font asset.
textToChange.font = FontAssetA;
}