
Where is audiosource and how can I change it?
-
- Posts: 8
- Joined: Thu Aug 01, 2024 1:52 pm
Where is audiosource and how can I change it?
I can't seem to find the audiosource being used by DSU. I need to adjust it (mainly volume) based on the sound settings in the game's options menu. Also, I want to stop the audio sometimes, for example when the player wants to skip through a cutscene. Pulling my hair out on this one, please help 

Re: Where is audiosource and how can I change it?
Hi,
If you're using sequencer commands such as Audio(), AudioWait(), SALSA(), etc., they use the Audio Source component that's on the subject. (In general, if you don't specify the subject then it's the GameObject associated with the dialogue entry's speaker.) If an Audio Source doesn't already exist on that GameObject, the sequencer command will create a default one. You can also add a Dialogue Actor component to a GameObject if you want to specify an alternate Audio Source location.
I recommend setting up an Audio Mixer asset with audio mixer groups for music, sfx, voice, etc. Then assign the appropriate mixer group to the Audio Source. This way you can change the audio mixer group's volume and it will automatically affect all Audio Sources assigned to that mixer group.
If you're using sequencer commands such as Audio(), AudioWait(), SALSA(), etc., they use the Audio Source component that's on the subject. (In general, if you don't specify the subject then it's the GameObject associated with the dialogue entry's speaker.) If an Audio Source doesn't already exist on that GameObject, the sequencer command will create a default one. You can also add a Dialogue Actor component to a GameObject if you want to specify an alternate Audio Source location.
I recommend setting up an Audio Mixer asset with audio mixer groups for music, sfx, voice, etc. Then assign the appropriate mixer group to the Audio Source. This way you can change the audio mixer group's volume and it will automatically affect all Audio Sources assigned to that mixer group.
-
- Posts: 8
- Joined: Thu Aug 01, 2024 1:52 pm
Re: Where is audiosource and how can I change it?
I do have a sound manager that handles setting sound, but I don't have DialogueActor's setup. I just want the narrator, and any NPCs, to speak through the same audio source. However, it looks like the AudioSource doesn't exist until dialogue starts since it is created one the fly and put on DialogueManager. Since it's not always there, I can't pre-set it to the right volume. How can I just have all my dialogue come through an AudioSource that I'm in control of?
Re: Where is audiosource and how can I change it?
Hi,
If you're talking about audio played by sequencer commands such as Audio() and AudioWait(), then two options are:
1. Specify the single Audio Source GameObject by name in the command. Concept example:
2. OR make a subclass of the sequencer command (e.g., SequencerCommandAudioWait.cs) and override the GetAudioSource() method. Concept example:
Then use CustomAudio() in place of AudioWait().
If you're talking about audio played by sequencer commands such as Audio() and AudioWait(), then two options are:
1. Specify the single Audio Source GameObject by name in the command. Concept example:
Code: Select all
AudioWait(myaudioclip, MyAudioGameObjectName)
Code: Select all
public class SequencerCommandCustomAudio : SequencerCommandAudioWait
{
protected override AudioSource GetAudioSource(Transform subject) => return MyAudioGameObject;
}