Hello, I am trying to use a coroutine to type word-by-word, below functions for letter by letter but I am not yet capable enough to split the string depending on the presence of a space so I can display each word individually. Word by word will solve an error I’m encountering with letter by letter.
tldr: How do I make this coroutine display word by word instead of letter by letter?
``<pre> public TextMeshProUGUI textMeshProText; public string contentText; public float letterPause = 0.1f; // Use this for initialization void Start () { string writeThis = contentText; StartCoroutine(TypeSentence(writeThis)); } IEnumerator TypeSentence(string sentence) { foreach (char letter in sentence.ToCharArray()) { textMeshProText.text += letter; yield return new WaitForSeconds(letterPause); } } } </pre>