public void DisplayNextSentence()
{
audioSsource.Stop();
if (sentences.Count == 0)
{
EndDialogue();
return;
}
string sentence = sentences.Dequeue();
isTalking = true;
StopAllCoroutines();
StartCoroutine(TypeSentence(sentence));
}
IEnumerator TypeSentence(string sentence)
{
audioSsource.PlayOneShot(audioClip);
dialogueText.text = "";
foreach (char letter in sentence.ToCharArray())
{
dialogueText.text += letter;
yield return null;
}
}
how do I stop the audio from talking if all the characters have been displayed/sentence has been com
Don’t try and fit your entire question into the subject line.
You won’t be able to use PlayOneShot if you need the option of interrupting it.
audioSsource.clip = audioClip;
audioSsource.Play();
...
audioSsource.Stop();
2 Likes