How to play sound when each word displays

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Syoka
Posts: 12
Joined: Sun Apr 21, 2024 1:38 pm

How to play sound when each word displays

Post by Syoka »

Hi, I would like to ask how to play sound when each word of dialogue displays.
example:
Dialog: "Forest is at the north of the village."
I would like play text sound like:
"Forest"->Play text sound ->"is"->Play text sound->"at"->Play text sound->...

Is there event for each word displays?
User avatar
Tony Li
Posts: 22886
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to play sound when each word displays

Post by Tony Li »

Hi,

Here are two ways you could do this:

1. Make a subclass of your typewriter effect (e.g., UnityUITypewriterEffect or TextMeshProTypewriterEffect). Override the PlayCharacterAudio(char) method to only play a sound if the character is non-alphanumeric (such as ' ' or '.').

2. Or use Text Animator for Unity and add a custom behavior tag such as <sound> between each word.
Post Reply