Мне нужно получить аудиоклип в папке ресурсов, так как я понимаю, что мне нужно использовать Resources.Load<AudioClip>(path)
или Resources.Load(path) as AudioClip
, но это просто не работает, оно даже не возвращает ноль, просто останавливает код
мой пример кода:
private void FetchAudioClipAndStartPlay(int userPos, int index)
{
AudioClip clip = Resources.Load($"Audio/Demo_ENG/D{userPos}a") as AudioClip;
Debug.Log("Starting Coroutine " + index);
StartCoroutine(PlayAudioClipAndStartRetrievingFromDatabase(index, clip));
}
IEnumerator PlayAudioClipAndStartRetrievingFromDatabase(int index, AudioClip clip)
{
Debug.Log("Starting to play " + index);
audioSource.PlayOneShot(clip, 1f);
yield return new WaitForSeconds(clip.length);
if (index < numberOfPlayers)
{
RetrieveFromDatabase(index++);
}
}
(не входит в сопрограмму)
![enter image description here](https://i.stack.imgur.com/27F57.png)
![enter image description here](https://i.stack.imgur.com/Lg8Ox.png)
Все аудиофайлы имеют формат .mp3
Любые рекомендации и советы очень ценятся!