public float GetPixelByStr(string str)
{
float pixel = 0;
for (int index = 0; index < str.Length; index++ )
{
float tempPixel = m_text.cachedTextGenerator.GetPreferredWidth(
str[index].Tostring(),
m_text.GetGenerationSettings(Vector2.zero));
pixel += tempPiexl;
}
return pixel;
{
float pixel = 0;
for (int index = 0; index < str.Length; index++ )
{
float tempPixel = m_text.cachedTextGenerator.GetPreferredWidth(
str[index].Tostring(),
m_text.GetGenerationSettings(Vector2.zero));
pixel += tempPiexl;
}
return pixel;
}
QQ交流群:162136059