- Home /
WWW can't read file from streamingAssetsPath when outside editor?
I'm using this coroutine to load a movie with WWW, and it works fine in the editor, but if I do a build, I get the error "Error Couldn't read a file:// file"
IEnumerator StartVideo()
{
string path = "file:///"+Application.streamingAssetsPath+"/Movies/movies1.ogg";
wwwData = new WWW(path);
yield return wwwData;
mt = wwwData.GetMovieTexture();
Debug.Log("Path: " + path);
Debug.Log("Error " + wwwData.error);
}
Why does this work in the editor but not in a packaged game?
I think the problem is clearly documented and a code solution is given. https://docs.unity3d.com/ScriptReference/Application-strea$$anonymous$$gAssetsPath.html
This is for a PC build, so I would think the path should be accessible.
Your answer
Follow this Question
Related Questions
Changing default animation type to Humanoid via script 1 Answer
How can I overwrite .asset using AssetDatabase.CreateAsset? 2 Answers
How do I solve a BuildAssetBundles Compilation Error that only occurs in the Editor? 1 Answer
Script works in Game View, but not in build 0 Answers
Can I know why I can't control volume of audiomixergroup without exposing parameters? 0 Answers