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. Dismiss Notice

Bug Only 2 Audioclips loaded into memory in WebGL player?

Discussion in 'WebGL' started by Unitiblis, Oct 30, 2021.

  1. Unitiblis

    Unitiblis

    Joined:
    Aug 7, 2018
    Posts:
    13
    Hi there,
    I started adding Audio to my WebGL game. I use 3 Tracks as background music, the music changes with a crossfade depending on context / player actions. Everything works as intended in Editor Play Mode.

    But when I build and run it in WebGL, the player only alternates between 2 audio clips instead of the 3. Adding Debug-Logs showed me that Unity actually says it is going to play the correct Audioclip, but what I am hearing is another one. After playing around with it for a while it looks like Unity only loads the first two AudioClips requested into memory, and as soon as another one is requested, it 'falls back' to the already loaded Clips.

    I could not find any information about this issue. I was also not able to connect the Profiler to the WebGL build ('could not connect to wss://{unityeditorip}'). Did I reach any memory limits already? The behaviour is the same in all browsers and I did not change any Audio-/Player-Settings.

    Anybody has some ideas what is happening there?

    Unity Version: 2021.2.0f1
     
  2. Unitiblis

    Unitiblis

    Joined:
    Aug 7, 2018
    Posts:
    13
    I realised now that this has to do with the new 'Compressed in Memory' feature. If I enable it, I only have 1-2 audioclips played. If I use 'Decompress on Load' everything works as intended. I am going to file a bug report for that
     
  3. OceanX000

    OceanX000

    Joined:
    Feb 24, 2021
    Posts:
    120
    Sounds terrible, I was thinking of using ‘'Compressed in Memory’ in 2021
     
  4. Dan_Kodable

    Dan_Kodable

    Joined:
    May 12, 2020
    Posts:
    30
    Did you ever file a bug for this?
    I am having this issue in 2021.2.4f1
    I have several sound clips loaded (Compressed in Memory) as well as music tracks loaded via addressables (Streaming) and when I change scenes in the game the music track changes, but I hear the same music track every time (whichever music track plays 1st).
    This works as expected in 2021.1.28f1
     
  5. unityruba

    unityruba

    Unity Technologies

    Joined:
    Nov 6, 2020
    Posts:
    233
    We're actually looking into this audio issue with the compressed in memory setting right now! But it would be super helpful for us to have bug reports with repro projects in them so we can identify the bug faster and make sure we aren't missing any corner cases, so please, open bug reports, share their numbers here (or send them to me), and we'll use them in our investigation! :)
     
  6. Unitiblis

    Unitiblis

    Joined:
    Aug 7, 2018
    Posts:
    13
    I field this back when I mentioned that I was going to file it. I was under the impression that I should only share it here once it was accepted, which happened yesterday: https://issuetracker.unity3d.com/is...-memory-audioclip-is-playable-in-webgl-player

    @unityruba did I misunderstand the process? Should I somehow inform you earlier about a repro/send you the repro in a different way?
    I also had a project attached to the filed report, since I can't see it in the issue, it might got lost somewhere? If I should reupload it, just let me know