I have a loop where I want to play a sound for each loop. However, what I get is the first sound and then a pause and after that I get the correct sounds after each other without the long pause.
The code:
async Task PopCards()
{
for (int i = 0; i < Utility.buttons_List.Count; i++)
{
audioData.Play(0);
Utility.buttons_List[i].transform.DOShakeScale(0.05f, 0.4f, 2, 80f, true, ShakeRandomnessMode.Harmonic);
Utility.buttons_List[i].transform.localScale = new Vector3(1, 1, 1);
await Task.Delay(100);
}
}
I also use DoTween.