EDIT: I updated the code to what I have currently. I'm not sure why but, the editor and my platform complained when I put the WWW in a co-routine, it seems to load the audio clips to the object but I cannot play them. In a script attached to the object I wait until the Audio Clip is loaded before I try to play it.
So I am trying to record some Audio through the microphone and then save an AudioClip to the disk as a .wav file and also save the filepath as a playerpref and then later I can come back and load the string into a url but, for some reason the Audio Clip doesn't get loaded properly as I can see that there is an audio clip on my audio source in runtime but, it has no name and it has no sound on it. However, when I press play in the inspector I can hear my sound
I am using SavWav.cs to save my audio clips to .wav files.
Here is the url(filepath) I am sending to my load method:
string filename = string.Format(@"CapturedAudio{0}_n.wav", Time.time);
string filepath = Path.Combine(Application.dataPath, filename);
Here is the method I am using to get the AudioClip:
private void SpawnObject(string savedNames, Vector3 savedPositions, Quaternion savedRotations)
{
GameObject cubeToSpawn = Instantiate(cube, savedPositions, savedRotations);
WWW www = new WWW("file:///"+savedNames);
cubeToSpawn.GetComponent<AudioSource>().clip = www.GetAudioClip(false, false, AudioType.WAV);
}
The obj is just a cube with an AudioSource attached to it that I instantiate prior to calling this method above.
The filepath works fine for saving but, for some reason it doesn't want to load the audio clip. Any help would be greatly appreciated.