Route Audio Source to Audio Mixer via script

I created an audio manager following a tutorial from brackeys but I want to route some audio sources to an audio mixer and control the volume. Problem is the audio sources have no output field to connect with an AudioMixer. How can I add the output field on the audio source via script (C#) so I can route it to my Audio Mixer

You would set the output mixer group, like so

        public AudioMixerGroup MyMixerGroup;

        public void AssignMixer(AudioSource source)
        {
            source.outputAudioMixerGroup = MyMixerGroup;
        }
2 Likes

I haven’t tested this but I think it should work. I will get back to you if it works. Thanks a lot!!!

It works!!! Thanks, you are a game saver