When it crashes, textInfo returns null. Therefore, I changed it like below, and seems working fine. public int GetCharCount() { var info = tmpText.textInfo; return info == null ? 0 : math.min(info.characterCount, info.characterInfo.Length); }
When it crashes, textInfo returns null.
Therefore, I changed it like below, and seems working fine.
public int GetCharCount()
{
var info = tmpText.textInfo;
return info == null ?
0 : math.min(info.characterCount, info.characterInfo.Length);
}