- Home /
load file with www on webplayer
I'm porting an ios game to webplayer version. I have some code that loads a file from the streamingassets folder using the WWW protocol. Is there a way to do the same thing from the webplayer?
function readProps(){
var www : WWW;
var url = "file:"+Application.streamingAssetsPath+"/props.csv";
// Debug.Log("url="+url);
www = new WWW (url);
yield www;
Debug.Log("download progress"+ www.progress);
if (www.error != null){
Debug.Log(www.error);
}
propinfo=www.data;
//Debug.Log(www.data);
}
How do I do the same thing for a webplayer version?
Comment
Best Answer
Answer by dansav · Mar 01, 2015 at 01:11 AM
I solved it. Whatever you put in the unity folder named StreamingAssets gets copied over to the web folder. To access something in the folder that is local you just have to use the correct path to your file.
var url = Application.dataPath + "/StreamingAssets/props.csv";