Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Question AudioMixerSnapshot.TransitionTo() in WebGL - Does not work

Discussion in 'WebGL' started by DonPuno, Apr 21, 2022.

  1. DonPuno

    DonPuno

    Joined:
    Dec 22, 2020
    Posts:
    57
    Unity Version: 2020.3.029f1

    Hello everyone,

    Today I realized about an issue, that apparently the TransitionTo method does not work in the WebGL build. However, in my PC build it does.

    I was wondering, if there is a possibility to use this function for WebGL builds or maybe there is an alternative way to proceed with the same functionality.

    Many thanks for your help!
     
    Last edited: May 3, 2022
  2. DonPuno

    DonPuno

    Joined:
    Dec 22, 2020
    Posts:
    57
    Any ideas? :cool:
     
  3. xavier-ateo

    xavier-ateo

    Joined:
    Aug 8, 2018
    Posts:
    12
    I'm using AudioMixer snapshots in a WebGL project that uses 2020.3.27f1 and TransitionTo() work fine for me.
    However, I don't use any filters on my groups and only change the volume, since many filters don't work in WebGL (as far as I know).

    You can look up the supported audio capabilites of 2020.3 here:
    https://docs.unity3d.com/2020.3/Documentation/Manual/webgl-audio.html

    Are you using Addressables by any chance? If so, look at this thread:
    https://forum.unity.com/threads/audio-mixer-and-asset-bundle.338077/#post-4410481
     
    DonPuno likes this.
  4. DonPuno

    DonPuno

    Joined:
    Dec 22, 2020
    Posts:
    57
    @xavier-ateo Many thanks for the reply. I guess I have to many filters, that are not supported in the WebGL Build. Basically I use the same appoach like you do. Creating snapshots and transitioning between them. In contrast I'm using Lowpass Simple and Pitch Shifter Filter within the snapshots for different audio channels.
     
    xavier-ateo likes this.
  5. xavier-ateo

    xavier-ateo

    Joined:
    Aug 8, 2018
    Posts:
    12
    No worries!
    I'm faking the lowpass effect on my background music track like this:
    I've exported the music track from my audio editing software a second time with a lowpass filter applied.
    Then I play the regular version and the lowpass version at the same time and shift between the two of them using different volume levels. It's a very hacky solution (the user has to download more data, more loaded audio clips = more memory consumption, it's not very flexible), but it works for my use case :)
     
    DonPuno likes this.
  6. DonPuno

    DonPuno

    Joined:
    Dec 22, 2020
    Posts:
    57
    I like your solution! Clever!
    It wouldn't have come to my mind to use a pre-edited audio file and shift between them. I will try it and many thanks for explanation! :D
     
    xavier-ateo likes this.