Page 1 of 1

Different AudioSource being used for some actors?

Posted: Fri Oct 27, 2023 7:13 pm
by farazk86
Hi,

I've added cutscene audio to my dialogue and following the entry tag tutorials, I have added ``AudioWait(entrytag)`` as the default sequence, and also named my audio files with the correct entry tags.

The audio is working fine and with minimal effort/setup (thanks a lot for making this so easy).

But the problem is that for some actors its using a different audio source?

I know that the audio source for the dialogue audio is the one that is already on the prefab in ``Dialogue Panel > Main Panel > Text Panel > Subtitle Panel > Subtitle TMP``

But when the audio/ dialogue is played, this source is only used for some actors.

For example, for most of the actors, the audio is playing but its not this source such that its audio clip is empty:
image_2023-10-28_001007002.png
image_2023-10-28_001007002.png (755.47 KiB) Viewed 525 times
Here, the audio is playing, and I can hear it but its not using the audio source on Subtitle TMP.

While for a few actors, this field is populated and this audio source is used, as can be seen from below screenshot
image_2023-10-28_001136266.png
image_2023-10-28_001136266.png (754.24 KiB) Viewed 525 times
Furthermore, it is not taking the volume from my Mixer which is 0.8, its very quiet at 0.1 volume, and the other actors are using an unknown audio source so I cant control their volume either.

Thanks

Re: Different AudioSource being used for some actors?

Posted: Fri Oct 27, 2023 7:43 pm
by Tony Li
Hi,

This sequencer command:

AudioWait(entrytag)

is equivalent to:

AudioWait(entrytag, speaker)

This plays the audio clip on the speaker GameObject's Audio Source. If the speaker doesn't have an Audio Source, it will add a default one.

To know which GameObject is a dialogue entry's speaker, please see: Character GameObject Assignments. Check the conversation's properties, the dialogue entry node's Actor dropdown, the speaker GameObject (e.g., if it has a Dialogue Actor component), and the Conversation Actor and Conversation Conversant fields on the Dialogue System Trigger if you're using one.

Add an Audio Source to the speaker GameOBject and assign your mixer group to it.

Re: Different AudioSource being used for some actors?

Posted: Sat Oct 28, 2023 6:23 am
by farazk86
Thanks for the quick reply, Toni.

But I would have the gameObjects own audio source use another mixer i.e. a mixer I setup for sound effects.

Is there a way to force all dialogue to be played via the audio source on the text panel of the dialogue prefab?

Also, I am not using any actor component or dialogue trigger component in my scenes.

Thanks

Re: Different AudioSource being used for some actors?

Posted: Sat Oct 28, 2023 9:22 am
by Tony Li
Hi,

If you're using the AudioWait() command, you can specify the text panel as the subject. If your text panel is uniquely named "Text Panel", use this sequence:

Code: Select all

AudioWait(entrytag, Text Panel)
Alternatively, you can make a subclass of AudioWait() and override GetAudioSource() to always return the Text Panel's audio source. Example:

Code: Select all

namespace PixelCrushers.DialogueSystem.SequencerCommands
{
    public class SequencerCommandAudioWaitText : SequencerCommandAudioWait
    {
        private static AudioSource textPanelAudioSource = null;
        
        protected override AudioSource GetAudioSource(Transform subject)
        {
            if (textPanelAudioSource == null) textPanelAudioSource = GameObject.Find("Text Panel").GetComponent<AudioSource>();
            return textPanelAudioSource;
        }
    }
}
In which case you'd use:

Code: Select all

AudioWaitText(entrytag)

Re: Different AudioSource being used for some actors?

Posted: Sun Oct 29, 2023 7:45 am
by farazk86
The

Code: Select all

AudioWait(entrytag, Text Panel)
worked perfectly. Thanks a lot :)

Re: Different AudioSource being used for some actors?

Posted: Sun Oct 29, 2023 9:15 am
by Tony Li
Glad to help!