Hey everyone. I’m trying to load a handful of sound files into an array via Javascript but the zeroth spot refuses to cooperate. I have all the sound file’s names in a string array and load the audio clip array using a for loop. Initially I thought the problem was the for loop but tried manually loading individual slots and found that all besides the very first slot will load via the script. If I try dragging and dropping a file from the resources folder into the array during runtime it works fine but players obviously can’t do that. Has anybody ever run into a problem like this before or does anybody have a possible solution?
Here’s basically what the JS looks like;
var sound = new AudioClip[6];
var sfile : String[] = ["Chime_01","Fireball_01","Roar_01","Snarl_01","Stomp_01","Sword_01"];
then later in Start()…
for ( var j : int = 0; j < 6; j++){
sound[j] = Resources.Load(sfile[j]);
Then in inspector I always see this…
Sound
size 6
Element 0 None(Audio Clip)
Element 1 Fireball_01
Element 2 Roar_01
Element 3 Snarl_01
Element 4 Stomp_01
Element 5 Sword_01
bizarre… Anyways thanks for your help in advance.