• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by CinnoMan · Feb 12, 2016 at 09:31 PM · audioeffectsmixing

How to bypass audio effects from script? (AudioMixer)

For my game, I intend to make heavy use of audio effects in Unity 5's AudioMixer. I understand how to expose parameters to control them from script.

But how do I bypass audio effects from script (to conserve cpu)? There seems to be no "enabled" property or parameter that I could set in the inspector, where other exposable parameters show up. There is only the toggle button in the mixer view itself.

Surely it's possible to do that from script?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by SoftAnswers · Feb 13, 2016 at 03:31 AM

your AudioSourceGameobject.SetActive(true/false);

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image CinnoMan · Mar 10, 2018 at 08:44 AM 0
Share

Weirdly, I've only seen this more than 2 years later.... :D

I'm constantly routing multiple audio sources to a mixer channel and want to still use the channel, but sometimes disable its audio effects. setting the AudioSource to inactive won't achieve what I want, unfortunately.

avatar image
0

Answer by moff84 · Mar 08, 2018 at 07:32 PM

Use snapshots. Have one with the effect on and one with it off. You can script to transitionTo another snapshot

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image CinnoMan · Mar 10, 2018 at 08:51 AM 0
Share

Thank you for your answer.

However, snapshots are not the solution for my use case. They are great when you have a handful of configurations you want to switch between, but with the granular changes I'm making all the time, that would be very messy and error-prone to solve with snapshots.

I guess I could create a sub mixer per channel as a workaround, is that what you meant? But that is also quite clunky and just seems like overkill. I don't quite understand what criteria they used to determine which mixer parameters were to be exposable and which weren't...

avatar image
0

Answer by DerLasseHenrich · Sep 23 at 09:31 PM

You can say audioSource.outputAudioMixerGroup = null. To enable that mixer later, simply assign it again.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image CinnoMan · Sep 24 at 01:04 PM 0
Share

Thank you for the suggestion. If it were just a single track where I want to "switch on/off" a single audio effect, I guess that would be a good work-around. However, I'd like to do so with multiple tracks and, more importantly, switch various effects on a channel on and off from code, so if there's two audio effects, that would already mean creating 4 different audio mixers for the various constellations, while also managing their snapshots etc. Sounds like a hard to maintain mess.

It's baffling the obvious simple solution of being able to enable/disable audio effects from code is still not possible 3 and half years later....

avatar image DerLasseHenrich CinnoMan · Sep 24 at 07:12 PM 0
Share

I see, yeah that's really annoying.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

40 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

multi Coloured Audio Waveform? 1 Answer

Audio Mixer Duck Volume no Input signal 0 Answers

Chain multiple effects in OnAudioFilterRead 0 Answers

Get spectrum data from specific Audio Mixer? 1 Answer

AudioMixer bypass effect with script 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges