Using Audio() instead AudioWait()

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
dzeessh
Posts: 3
Joined: Thu Mar 07, 2024 9:12 pm

Using Audio() instead AudioWait()

Post by dzeessh »

Hi, I want to play audio mp3 in the dialogue scene, but I need to use Audio() because it will still continue playing the dialogue while mp3 still playing. But Idk why when i use it, its just skipped it and not play the audio.

Audio(Audio/HeavyBreathingslowlyup);
Audio(Audio/SimpleHeartbeat)
User avatar
Tony Li
Posts: 22886
Joined: Thu Jul 18, 2013 1:27 pm

Re: Using Audio() instead AudioWait()

Post by Tony Li »

Hi,

If you don't specify a subject, it will use the speaker GameObject's audio source. This means the first command will use the speaker's audio source to play HeavyBreathingslowlyup, and then the second command will stop the audio source to play SimpleHeartbeat instead.

Two options:

1. Specify different subjects, such as:

Code: Select all

Audio(Audio/HeavyBreathingslowlyup, PlayerMouth);
Audio(Audio/SimpleHeartbeat, PlayerHeart)
This assumes the scene has GameObjects named PlayerMouth and PlayerHeart. It will play audio on those GameObjects.

2. Or use 'oneshot' to play the audio clips in a detached "one shot" manner that won't interrupt each other:

Code: Select all

Audio(Audio/HeavyBreathingslowlyup,,oneshot);
Audio(Audio/SimpleHeartbeat,,oneshot)
In the example above, I didn't specify a subject (hence the ",,"), but you could specify one if you want.
dzeessh
Posts: 3
Joined: Thu Mar 07, 2024 9:12 pm

Re: Using Audio() instead AudioWait()

Post by dzeessh »

Thank you
Post Reply