Page 1 of 1

How to play an audio after a NPC message

Posted: Mon Jan 24, 2022 3:27 am
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.

Re: How to play an audio after a NPC message

Posted: Mon Jan 24, 2022 8:54 am
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.