Hi, I'm wondering if it's possible to make it so that a speech sound effect plays once per dialogue?
I have speechsfx1.mp3 attached to my NPC Text Scroll Override (each character has a different sound), and at the moment while watching the text scroll, the sound plays about every second, when I want it to only play once. I can't find any options to change this and there's only an option for a sound every syllable which is the complete opposite of what I want haha
Basically so that the sound plays only once in a dialogue.
Thank you!
Comments
Audio sounds normally come in two flavours - actual speech of the line in question (played once) or scrolling audio (played continually).
To play a scrolling sound just once, you could try extending the length of the scound with some silence, as AC won't play another instance of the sound until the previous one has finished (unless Play audio on every letter? is checked in the Speech Manager).
Alternatively, if you're comfortable with some very simple coding, you could write a hook for the OnStartSpeech event that plays the audio clip through script. The OnStartSpeech event is demonstrated in the custom events tutorial. To play an audio clip without an audio source, you can just use:
AudioSource.PlayClipAtPoint (myAudioClip, AC.KickStarter.mainCamera.transform.position);
Which will play the audio clip variable "myAudioClip" at the same position as AC's MainCamera.
What do I have to do to 'create' the myAudioClip variable? Or what do I replace it with?
public AudioClip myAudioClip;
Place the above outside of the function (but inside the class) and you should find it as a field in the component's Inspector. You can then place the script on a GameObject in your scene, assign the audio clip in its Inspector and it should all work.
if (speakingCharacter != null && speakingCharacter.gameObject.name == "Test")