Typewriter Dialogue Beeps?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
AlexNerd
Posts: 39
Joined: Sat Jun 29, 2019 11:46 am

Typewriter Dialogue Beeps?

Post by AlexNerd »

Is there any way to have different dialogue beeps for different characters a la Undertale?
User avatar
Tony Li
Posts: 22149
Joined: Thu Jul 18, 2013 1:27 pm

Re: Typewriter Dialogue Beeps?

Post by Tony Li »

Hi,

Yup! Assign them to the typewriter effect's Audio Clip and Additional Audio Clips list. It will randomly play one of the audio clips for each character.
lardmaster
Posts: 18
Joined: Thu Jun 25, 2020 9:17 pm

Re: Typewriter Dialogue Beeps?

Post by lardmaster »

Hi, I'm sorry to revive this old thread, but was wondering if there was a way to not have the character choose a random audio clip, but rather be able to assign a specific one to a character?

Also is there a way to disable the typewriter sound and play another audio clip instead using the AudioWait() command in the sequencer for just one line, then continue to use the typewriter sound effect? Like if a character becomes angry for example.
User avatar
Tony Li
Posts: 22149
Joined: Thu Jul 18, 2013 1:27 pm

Re: Typewriter Dialogue Beeps?

Post by Tony Li »

Hi,

Make a subclass of the typewriter class (e.g., UnityUITypewriterEffect) and override the PlayCharacterAudio(char) method. Example:

Code: Select all

public class CustomTypewriterEffect : UnityUITypewriterEffect
{
    public AudioClip exclamationSound;
    
    protected override void PlayCharacterAudio(char c)
    {
        if (c == '!') // Play a special sound for exclamation marks.
        {
            audioSource.PlayOneShot(exclamationSound);
        }
        else        
        {
            base.PlayCharacterAudio(c);
        }
    }
}
Then use your subclass in place of the original typewriter effect.
Post Reply