Search Unity

Bug 2023.2.0a8 Problems with multiple audio play

Discussion in 'Editor & General Support' started by ChickChuck2, Mar 31, 2023.

  1. ChickChuck2

    ChickChuck2

    Joined:
    Aug 5, 2019
    Posts:
    8
    Problem: My problem is caused by ONE AUDIO not being played frequently with each click that occurs, basically it happens only once, and when the audio ends it plays again, ignoring that there can have two audios playing at once

    my code:

    Code (CSharp):
    1.  
    2. void TMPAUDI()
    3.     {
    4.         GameObject obj = new("audi");
    5.         obj.AddComponent<AudioSource>();
    6.         //obj.GetComponent<AudioSource>().PlayOneShot(Hitmarker, (float)ConfigManager.GetSavedValue("hitmarkVolume")); TESTED
    7.         obj.GetComponent<AudioSource>().clip = Hitmarker;
    8.         obj.GetComponent<AudioSource>().volume = (float)ConfigManager.GetSavedValue("hitmarkVolume");
    9.         obj.GetComponent<AudioSource>().Play();
    10.         Destroy(obj, Hitmarker.length + 0.5f);
    11.     }
    12.  
    notes:
    • I was using unity beta 2023.1.0.b9 (I think) but for TextMeshPro problems I had to change
    • This only happens on android
    • [EDIT] Problem ocurred on 2023.1.0b10 BETA


    I tried:
    1. use PlayOneShot
    2. put delay on Destroy()
    3. Cry
     
    Last edited: Apr 1, 2023
  2. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,059
    What is the exact issue?
    The looping? It so, disable looping as well
     
  3. ChickChuck2

    ChickChuck2

    Joined:
    Aug 5, 2019
    Posts:
    8
    you can see the difference on this videos

    On Editor Play


    On Android Buid


    the audio in Editor Play happens with each click, while the audio in android happens every time the previous audio ends

    this happens with FixedUpdate too