Title…
Am I missing something?
private TextMeshProUGUI dialogueBox;
// Start is called before the first frame update
void Start()
{
dialogueBox = gameObject.GetComponent<TextMeshProUGUI>();
dialogueBox.text = "Atirei um pau a um gato to to ";
}
private void Testes()
{
int totalVisibleCharacters = dialogueBox.textInfo.characterCount;
}
totalVisibleCharacters is returning 0?
The content of the textInfo gets populated once the text object has been rendered. This typically happens after LateUpdate() and just before the camera is rendered.
For most use case this is fine (in terms of when the textInfo gets populated) however, for those time where you need access to the textInfo for whatever reason, you can call TMP_Text.ForceMeshUpdate() which will force a generation of the text right away.
There should be several threads on the forum covering this in more details.