So I’m trying to get personal Audio loading working where people can play their own music, but I ran into a few problems with an overly complicated script (which automatically gets the file-path) so I stripped back the code to find out what the issue was.
Here is the code:
var Source1 : GameObject;
var url : String;
function Start()
{
var www = new WWW(url);
Source1.audio.clip = www.GetAudioClip(false,true, AudioType.WAV);
if (System.IO.Directory.Exists(MusicFolder)) {
} else {
System.IO.Directory.CreateDirectory(MusicFolder);
}
}
function Update () {
if(!Source1.audio.isPlaying && Source1.audio.clip.isReadyToPlay)
Source1.audio.Play();
}
I have used a screenshot of the Source1 GameObject too help.
The url variable is set to:
J:\13 DESIGNED GAMES $$$$$$$$$$$$$$$\FULL GAMES\GREEBROLL\Greebroll Menu\MenuAmbience01.wav
Here is a screenshot of the actual filepath:
When I press play, the Audio Clip variable on the Audio Source component on the Source 1 Gameobject is blank (doesn’t state MenuAmbience01) instead it just has the small audio icon.
Help would be greatly appreciated.