How to play an audio after a NPC message

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
tanxz
Posts: 1
Joined: Sat Jan 22, 2022 1:47 pm

How to play an audio after a NPC message

Post by tanxz »

Hey, I am using the SMS Dialogue template and would like to add a sound effect that plays everytime a message is sent by the NPC but couldn't figure out how. Thanks in advance.
User avatar
Tony Li
Posts: 21981
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to play an audio after a NPC message

Post by Tony Li »

Hi,

Put your sound effect in a folder named 'Resources'. (You can also use Addressables, but using Resources is easier, and for just one sound effect that's frequently reused it's perfectly fine.)

Then add an Audio() command to the Dialogue Manager GameObject's Display Settings > Camera & Cutscene Settings > Default Sequence. For example, if the original Default Sequence is 'Delay({{end}})' and the sound effect file is named 'incoming', then set the Default Sequence to:

Code: Select all

Delay({{end}}); Audio(incoming)
Set the Default Player Sequence to the original value of Default Sequence field -- e.g., just Delay({{end}})

For more info about playing audio and doing other related activity such as playing animation, see the Cutscene Sequence Tutorials.
Post Reply