首页 > TAG信息列表 > totalWidth

Unity使用Font.GetCharacterInfo 和 Font.RequestCharactersInTexture获取UnityEngine.UI.Text文本中每个字符的宽度信息

using UnityEngine; using UnityEngine.UI; public class FontTest : MonoBehaviour { void Start() { Test(); } void Test() { string str = GetComponent<Text>().text; Font font = GetComponent<Text>().font;