Page 1 of 1

PLAY TWO AUDIO FILES AT ONCE!

Posted: Tue Aug 20, 2024 4:33 am
by alexprenzlersound
Hi there!

We're using Pixel Crushers to implement audio to Dialogue nodes through 'Conversations' branches, calling the SFX by dropping them into the 'Sequence' function.

When I add two sound effects on top of each other nothing plays, how do I play two sound effects at once using this system?

Thanks for your time! :D

Re: PLAY TWO AUDIO FILES AT ONCE!

Posted: Tue Aug 20, 2024 8:23 am
by Tony Li
Hi,

By default, when you drag an audio clip into the Sequence field, it will add an AudioWait() sequencer command, or an Audio() sequencer command if you've changed the default behavior as mentioned in your other thread.

The command will attempt to play the audio clip on the speaker's Audio Source component. (For info on which GameObject is the speaker, see Character GameObject Assignments.) If the speaker doesn't already have an Audio Source component, the command will add a default one.

Any single Audio Source can only play one audio clip at a time unless you play a "one shot". To play a one shot, specify the special keyword "oneshot" at the third parameter to the command, such as:

Code: Select all

Audio(audioFileA, , oneshot)
Audio(audioFileB, , oneshot)
(Notice that I left the second parameter blank, so it will default to playing on the speaker.)

Alternatively, you can specify a different GameObject for the second Audio() command:

Code: Select all

Audio(audioFileA, GO_1)
Audio(audioFileB, GO_2)
In the sequence above, the first command will play audioFileA through the Audio Source component on the GameObject named GO_1. The second command will play audioFileB through the Audio Source on GO_2.