- Home /
AudioClip dont listened in script component
Hi, i am trying load all my audio resources for a folder, and anything happen. So, this is my code:
public AudioClip[] audioMeme;
// Use this for initialization
void Start () {
audioMeme = Resources.LoadAll<AudioClip>("sounds");
}
And when i play my project, my audio sources dont be list in AudioClip array:
Is this normal ? Or am i doing something wrong ?
Answer by slavo · May 10, 2017 at 04:11 PM
Make sure that your sounds folder is in Resources folder. "Assets/Resources/sounds"
https://docs.unity3d.com/ScriptReference/Resources.Load.html
"Loads an asset stored at path in a Resources folder."
It does not matter in what folder called "Resources" it would be located, it search them all
"All assets that are in a folder named "Resources" anywhere in the Assets folder can be accessed via the Resources.Load functions. Multiple "Resources" folders may exist and when loading objects each will be examined."