主要处理方式是:
1.获取当前使用的UIFont
2.重构UIFont的中使用texture的字符集;
一般情况下,在UIFont的size为32时,重构时使用1500个汉字。下面是示例代码:
UILabel lable = GameObject.FindObjectOfType(typeof(UILabel)) as UILabel ;
if(lable != null){
Debug.LogWarning("rebuild font!");
UIFont font = lable.font;
System.Text.StringBuilder strBuilder = new System.Text.StringBuilder(2048);
for(int i =0x4e00;i<0x4e00+1500;i++){
char c = (Char)i;
strBuilder.Append(c);
}
font.dynamicFont.RequestCharactersInTexture(strBuilder.ToString(), font.dynamicFontSize, font.dynamicFontStyle);
}
其中0x4e00是Unicode字符集中第一个汉字对应的数值.