title: Unity WebGL External Assets
body: <p>I'm developing some webGL project in Unity that has to load some external images from a directory, it runs all fine in the editor, however when I build it, it throws a Directory Not Found exception in web console. I am putting the images in Assets/StreamingAssets folder, that will become StreamingAssets folder in the built project (at root, same as index.html). Images are located there, yet browser still complains about not being able to find that directory. (I'm opening it on my own computer, no running web server)</p>
  
  <p>I guess I'm missing something very obvious, but it seems like I could use some help, I've just started learning unity a week ago, and I'm not that great with C# or JavaScript (I'm trying to get better...) Is this somehow related to some javascript security issues? </p>
  
  <p>Could someone please point me in the right direction, how I should be reading images(no writing need to be done) in Unity WebGL?</p>
  
  <pre><code>string appPath = Application.dataPath;
  string[] filePaths = Directory.GetFiles(appPath, "*.jpg");
  </code></pre>
  
  <p>According to unity3d.com in webGL builds everything except threading and reflection is supported, so IO should be working - or so I thought:S</p>
  
  <p>I was working around a bit and now I'm trying to load a text file containing the paths of the images (separated by ';'):</p>
  
  <pre><code>    TextAsset ta = Resources.Load&lt;TextAsset&gt;("texManifest");
      string[] lines = ta.text.Split(';');
  </code></pre>
  
  <p>Then I convert all lines to proper path, and add them to a list:</p>
  
  <pre><code>    string temp = Application.streamingAssetsPath + "/textures/" + s;
      filePaths.Add(temp);
  </code></pre>
  
  <p>Debug.Log tells me it looks like this: </p>
  
  <p>file://////Downloads/FurnitureDresser/build/StreamingAssets/textures/79.jpg</p>
  
  <p>So that seems to be allright except for all those slashes (That looks a bit odd to me)</p>
  
  <p>And finally create the texture:</p>
  
  <pre><code>    WWW www = new WWW("file://" + filePaths[i]);
      yield return www;
      Texture2D new_texture = new Texture2D(120, 80);
      www.LoadImageIntoTexture(new_texture);
  </code></pre>
  
  <p>And around this last part (unsure: webgl projects does not seem easily debuggable) it tells me: NS_ERROR_DOM_BAD_URI: Access to restricted URI denied</p>
  
  <p>Can someone please enlighten me what is happening? And most of all, what would be proper to solution to create a directory from where I can load images during runtime?</p>