Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug FMOD returns error code 36 (FMOD_ERR_INVALID_HANDLE) executing setRelativeAudibility

Discussion in 'Audio & Video' started by AllenAtFortis, Dec 22, 2022.

  1. nxtboyIII

    nxtboyIII

    Joined:
    Jun 4, 2015
    Posts:
    279
    Error happening to me too. Unity 2022.2.18f1
    Makes the game unplayable, so many logs
     
  2. Aoedipus

    Aoedipus

    Joined:
    Jan 31, 2019
    Posts:
    25
    Happening to me too in the latest LTS release :(. I tried 2022.x some time ago, then had to revert back to a 2021 LTS flavor (.21 in my case) for it and other audio problems to go away. When I saw in the 2022 LTS patch notes that it had supposedly been resolved I was guardedly optimistic. I spent all day yesterday dealing with other integration issues before I could build and test, only to find the problem remained. (Totally off topic, but build times also ballooned from 2-3 minutes in 2021, to well over 15 minutes with 2022, while shadows exhibited very strange distortion when rendered in a WebGL build compared to what's visible in the editor. Another deal breaker.) So back to 2021 I go. It's both frustrating and time-consuming to be used as QA by Unity and to forego other valuable features the new "stable" release has to offer. I hate to complain, but... more bodies should be dedicated to WebGL in-house. Even a band-aid solution would be welcome. Using an alpha version, assuming that even works, is not a viable option, and back-porting shouldn't have to be either.
     
    mdrunk likes this.
  3. Eliseevich

    Eliseevich

    Joined:
    Sep 12, 2018
    Posts:
    1
    Updated my project to Unity version 2023.2.0a17, errors still appear in hundreds as before. But the build size has decreased by 1 MB, at least something...
     
  4. nxtboyIII

    nxtboyIII

    Joined:
    Jun 4, 2015
    Posts:
    279
    this needs to be fixed, still happening in 2022.3.2f1
     
  5. nxtboyIII

    nxtboyIII

    Joined:
    Jun 4, 2015
    Posts:
    279
    It's not just an inconvenience, the browser console is being spammed a ton which isn't great for performance...
     
    Unifikation likes this.
  6. patrickk2

    patrickk2

    Joined:
    Dec 8, 2019
    Posts:
    92
    Hello everyone!

    Are there any updates on this issue? I Updated my project the the LTS version 2022.3.1f, but the errors still periodically appear and spam the console of the WebGL build.

    The errors are

    and
    Is there a way to just silence the errors in the console?

    Thanks in advance for any tipps or inputs on this issue!

    Best regards,
    Patrick
     
    mdrunk likes this.
  7. nxtboyIII

    nxtboyIII

    Joined:
    Jun 4, 2015
    Posts:
    279
    I'm on 2021.3.2f1 and the error persists
     
  8. a_yanovski

    a_yanovski

    Joined:
    Feb 1, 2022
    Posts:
    9
    also happening on 2022.3 LTS. WebGL builds became unplayable after upgrading
     
  9. SeventhString

    SeventhString

    Unity Technologies

    Joined:
    Jan 12, 2023
    Posts:
    380
    This is worrisome. By "unplayable" do you mean that the game build is simply broken or lagging or something else? Can you elaborate?
     
  10. a_yanovski

    a_yanovski

    Joined:
    Feb 1, 2022
    Posts:
    9
    similar to some of the others posts - the client logs the error out so much it slows to a crawl
     
    mdrunk and nxtboyIII like this.
  11. a_yanovski

    a_yanovski

    Joined:
    Feb 1, 2022
    Posts:
    9
    Trying to get to a repro case because it doesn't happen straight away or consistently.
     
  12. Ctrl_4lt_Del

    Ctrl_4lt_Del

    Joined:
    Apr 13, 2019
    Posts:
    3
    I also have the same problem, and I tried to upgrade from 2022 LTS to 2023.2.0.a20, because I saw that this issue supposedly fixed the problem in 2023.2.0a5.

    But I get the same thing, after some playtime, these errors start to get spammed in the browser console, hundreds of them per minute:

    ./Modules/Audio/Public/AudioSource.cpp(1723) : Error executing dspHead->setRelativeAudibility(relativeAudibility) (An invalid object handle was used. )


    FMOD returns error code 36 (FMOD_ERR_INVALID_HANDLE) executing setRelativeAudibility


    I also noticed that besides the above errors that are being spammed hundreds of times per minute, Unity 2023.2.0.a20 also started to occasionally show these things in the browser console:

    Trying to get length of sound which is not loaded.


    Channel.playSoundClip error. Exception: TypeError: Failed to execute 'start' on 'AudioBufferSourceNode': The provided double value is non-finite.


    Additionally, I tried to downgrade to Unity 2021 LTS (quite troublesome, since this broke all the Box colliders which now for some reason had their sizes reset to 2). And I got the same errors spammed in the console.

    Would be nice to receive a fix for this as fast as possible, since it's affecting one of my released games.
     
    dhtpdud528 likes this.
  13. Ctrl_4lt_Del

    Ctrl_4lt_Del

    Joined:
    Apr 13, 2019
    Posts:
    3
    The way I "fixed" this, though you cannot really call it a fix, is by preventing the logs regarding that issue from being displayed to the console. This is dumb, but when you waste an entire day trying to fix something like this, where even Unity version upgrades/downgrades don't work, you become quite "creative".

    The "fix":

    1. In C:\Program Files\Unity\Hub\Editor\2022.3.3f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\UnityLoader\UnityLoader.js find this function
    print: function (message) {

    and just add this there
    if(typeof message === 'string' && message.includes("FMOD returns"))return;


    2. In C:\Program Files\Unity\Hub\Editor\2022.3.3f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\lib\Logging.js find this line
    case 4: //LogType_Exception

    and just prevent that console.error
    if(!str.includes('AudioSource.cpp')) console.error (str);


    On the next build, you'll get these fixes in your UnityLoader and Framework files, and you won't see those errors in the console anymore.
     
  14. desenholdb

    desenholdb

    Joined:
    Oct 4, 2012
    Posts:
    12
    Preventing the logs prevents the crash over time?
     
  15. a_yanovski

    a_yanovski

    Joined:
    Feb 1, 2022
    Posts:
    9
    This is cheeky. And I love it
     
    mdrunk likes this.
  16. Ctrl_4lt_Del

    Ctrl_4lt_Del

    Joined:
    Apr 13, 2019
    Posts:
    3
    Well, my game wasn't crashing at all to start with. It was just annoying for me to see all those logs/errors in the analytics service, and to be unable to properly spot any errors in the browser console due to them being spammed there.

    But aside from that, I didn't encounter any crashes/audio issues, though the game was indeed lagging a little bit with those errors being spammed, also annoying.
     
  17. sandsalamand

    sandsalamand

    Joined:
    Jan 9, 2020
    Posts:
    23
    I was having this issue when switching from the main menu scene to the game scene, but managed to resolve it by switching from LoadSceneMode.Single to LoadSceneMode.Additive, and then unloading the previous scene asynchronously.

    Code (CSharp):
    1. private static IEnumerator PreLoadScene(string sceneToLoad, Action<AsyncOperation> onLoaded90PercentAction)
    2.     {
    3.         yield return null;
    4.  
    5.         AsyncOperation asyncOperation = SceneManager.LoadSceneAsync(sceneToLoad, LoadSceneMode.Additive);
    6.         //Don't let the Scene activate until you allow it to
    7.         asyncOperation.allowSceneActivation = false;
    8.  
    9.         bool hasActivated = false;
    10.         while (!asyncOperation.isDone)
    11.         {
    12.             if (asyncOperation.progress >= 0.9f)
    13.             {
    14.                 if (!hasActivated)
    15.                 {
    16.                     onLoaded90PercentAction?.Invoke(asyncOperation);
    17.                     hasActivated = true;
    18.                 }
    19.             }
    20.             yield return null;
    21.         }
    22.     }
    I preload the main scene additively, then when it reaches 90%, I start unloading the menu scene asynchronously with
    SceneManager.UnloadSceneAsync
    and set
    asyncOperation.allowSceneActivation = true
    (this is passed in through the onLoaded90PercentAction in my example, but you could just hard-code it there instead).

    I also needed to call
    Destroy()
    on the audio listener in the main menu scene, and
    Stop()
    on the AudioSource when the main scene reached 90% loading.
     
  18. AllenAtFortis

    AllenAtFortis

    Joined:
    Apr 8, 2022
    Posts:
    2
    I believe we had some luck mitigating this issue by pooling our AudioSources instead of placing audiosources on any GameObject that wanted to play a sound... But we still see the issue periodically.
     
  19. CoolRash

    CoolRash

    Joined:
    Jul 14, 2021
    Posts:
    1
    still this f**cking spam FMOD return. 2022.2.11f1. how this fix?
     
  20. a_yanovski

    a_yanovski

    Joined:
    Feb 1, 2022
    Posts:
    9
    Still an issue on 2022.3.11f1. Release notes for 2022.3.6f1 LTS say it should be fixed:
    • Web: Fixed bug in WebGL's FMOD implementation that caused the console to be spammed with errors when using the PlayOneShot API. (UUM-40643)
    @SeventhString any news?
     
  21. SeventhString

    SeventhString

    Unity Technologies

    Joined:
    Jan 12, 2023
    Posts:
    380
    @a_yanovski
    I do see a note about it being fixed and tested in 2022.3.7f1, I'll look into it.
     
  22. SeventhString

    SeventhString

    Unity Technologies

    Joined:
    Jan 12, 2023
    Posts:
    380
    So I did try on a fresh build of 2022.3.11f1 and .13f1 and they both seem to have the fix. The repro project from the issue you linked does not trigger that log with these version on my Windows environment on Chrome, Firefox or Edge, with with a Development and regular build.

    What does your setup look like?
     
  23. xucian

    xucian

    Joined:
    Mar 7, 2016
    Posts:
    803
    God that warning was annoying. You have no idea at what great lengths I went to suppress it, finally settled for just disabling all my beloved infos/warns with:
    Code (CSharp):
    1.  
    2. Debug.unityLogger.filterLogType = LogType.Exception;
    3. UnityEngine.Debug.Log($"Disabling logging on WebGL to prevent FMOD error spamming the console. " +
    4.     $"Allowed log types: {Debug.unityLogger.filterLogType}");
    5.  
    Leaving this for anyone that can't afford upgrading (I'm also temporarily in this boat, as we have many moving parts, particularly in the Addressables space, where anything can break with updates)
     
    radiantboy likes this.
  24. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    still didnt get rid of it for me :(
     
  25. dhtpdud528

    dhtpdud528

    Joined:
    Apr 8, 2018
    Posts:
    23
    "Trying to get length of sound which is not loaded."
    same here 2023.2.3f1
    +2022.3.15f1
     
    Last edited: Feb 17, 2024
  26. jkj_spillehallen

    jkj_spillehallen

    Joined:
    Aug 11, 2022
    Posts:
    3
    2023.1.0b8 and 2023.2.3f1 - Same problem

    Comes after 15 minutes of playing (in our case).
    All sounds loaded at start up and never released. No scene reload.
    Most sounds are loadtype: Decompress on Load
    3 sounds are loadtype: Streaming (1 is played at a time, but switches around frequently)

    Does not seem to be related to any specific sound, and does not prevent playing sounds.
    Letting it run for a long time (1.5hour) it will eventually freeze the game loop (unfortunately all the times it happened the browser also clears all my logs so I have no output from that). Note. it is a gameloop freeze (rendering stops), not a frame reload, and browser respond otherwise normally.

    ./Modules/Audio/Public/AudioSource.cpp(1574) : Error executing dspHead->setRelativeAudibility(relativeAudibility) (An invalid object handle was used. )
     
    Last edited: Feb 19, 2024
  27. xucian

    xucian

    Joined:
    Mar 7, 2016
    Posts:
    803
    interesting. did you double-check? that was my solution at that time.
    the harder solution is to just make sure there are no 2 AudioSources playing at the same time, but some games do require that (crossfading and such), so it's not an universal fix either.