- Home /
Question by
skarhunter · Apr 12, 2018 at 04:20 PM ·
webglxmlstreamingassets
Application.streamingAssetsPath not working with WebGL build
I want to load a XML files from a folder in the StreamingAssets. I have put them there becouse they were not included in the build.
So far I have been using this:
System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(Application.streamingAssetsPath +
"/Levels/level" + levelNumber);
That works fine in the editor as it gives me this:
C:/Users/name/Desktop/projectname/projectfolder/Assets/StreamingAssets/Levels/level1
But as soon as I try to build the game to WebGL it can't find the files in the directory and I get this Exception:
DirectoryNotFoundException: Directory 'file:/C:/Users/name/Desktop/Projectname/Builds/WebGLV(0.0.8)/StreamingAssets/Levels/level1' not found.
The files are located in:
C:/Users/name/Desktop/Projectname/Builds/WebGLV(0.0.8)/StreamingAssets/Levels/level1
So you can tell if gets the wrong path due the the addage of file:
I would like to know why it puts file:/
at the beginning. And if someone knows, how to fix this.
Comment