Page 1 of 1

Dialogue Sounds

Posted: Fri Oct 28, 2022 3:36 pm
by 7ports
Hi Forum,

I was wondering if there was an event related to specific characters being displayed or an event related to an entire word being displayed that could be hooked in to. I want to play sounds on a per word basis when a character is speaking rather than on a per symbol basis. I think detecting space symbols and playing sounds using those would work as well.

Please let me know if there is a way to do either of these.

Cheers,
Raj

Re: Dialogue Sounds

Posted: Fri Oct 28, 2022 3:55 pm
by Tony Li
Hi Raj,

If you're using the Dialogue System's typewriter effect, you can hook into the OnCharacter() UnityEvent or make a subclass of the typewriter effect and override the PlayCharacterAudio(char) method. To identify a word in PlayCharacterAudio(), you can check if the current character is a non-word character such as a space or punctuation. If so, then you can go backward from there to the previous space (or beginning of string) to identify the word.