Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Audio SoundManager.LoadFMODSound causes a critical spike

Discussion in 'Audio & Video' started by ysalpha, Oct 14, 2021.

  1. ysalpha

    ysalpha

    Joined:
    Feb 2, 2017
    Posts:
    52
    Code (CSharp):
    1. var handle = Addressables.LoadAssetAsync<AudioClip>( "bgm/001" );
    2. yield return handle;
    Just by loading the above.
    SoundManager.LoadFMODSound would cause a very large spike.

    profiler.png



    The settings for this AudioClip are as follows, it should be streaming...
    inspector.png


    Does anyone know the cause of the problem?
     
    hhoffren likes this.
  2. ysalpha

    ysalpha

    Joined:
    Feb 2, 2017
    Posts:
    52
    Does the problem only occur when using 'Use Asset Database'?
    nobody...
     
  3. camel4u_wangzichen

    camel4u_wangzichen

    Joined:
    Feb 24, 2021
    Posts:
    1
    I also had the same problem
    Snipaste_2022-03-10_16-51-10.png
     

    Attached Files:

  4. airoll

    airoll

    Joined:
    Jan 12, 2021
    Posts:
    37
    +1, has anyone found a solution to this problem?
     
  5. The_Island

    The_Island

    Unity Technologies

    Joined:
    Jun 1, 2021
    Posts:
    502
    If it still happens, please open a bug report.
     
  6. AndyUnityDeveloper

    AndyUnityDeveloper

    Joined:
    Dec 7, 2013
    Posts:
    7
    @airoll, check your import settings on your audio file. I also had a large spike from SoundManager.LoadFMODSound. (In my case however, I am not streaming the AudioClip)
    Selecting the option "Load in background" fixed the spike, as the loading is no longer on the main thread. Switching to streaming, or loading the file as compressed in memory also reduce the spike significantly.
    Unity 2021.3.9f1
     
  7. airoll

    airoll

    Joined:
    Jan 12, 2021
    Posts:
    37
    AndyUnityDeveloper likes this.
  8. APTEM59

    APTEM59

    Joined:
    Dec 27, 2019
    Posts:
    27
    But if I load audio clip from device storage using UnityWebRequest, there is no way to toggle loadInBackground, because it's read-only.
     
    mcBao likes this.
  9. OndraPaska

    OndraPaska

    Joined:
    Jul 5, 2014
    Posts:
    15
    SoundManager.LoadFMODSound
    112.31ms
    Current frame accumulated time:
    230.69ms for 2 instances on thread 'Main Thread'


    Hi, it still happens (2022.3.10), does anyone have any ideas? I tried switching everything to LoadInBackground, but it did not change. I am not using FMOD.

    I can see:

    but I cannot even find what asset is being loaded
     
    Last edited: Apr 29, 2024