title: Making a Texture2D readable in Unity when loading from server
body: <p>I'm using <code>DownloadHandlerTexture.GetContent</code> to get my texture:</p>
  
  <pre><code>www = UnityWebRequest.GetTexture("http://www.example.com/loadTex/?tag=" + tag);
  www.SetRequestHeader("Accept", "image/*");
  async = www.Send();
  while (!async.isDone)
      yield return null;
  
  if (www.isError) {
      Debug.Log(www.error);
  } else {
      yield return null;
      tex = DownloadHandlerTexture.GetContent(www);
  }
  </code></pre>
  
  <p>After loading I would like to cache it to a file so I do:</p>
  
  <pre><code>byte[] pic = tex.EncodeToPNG();
  File.WriteAllBytes(Application.persistentDataPath + "/art/" + tag + ".png", pic);
  </code></pre>
  
  <p>At this point I get the exception:</p>
  
  <pre><code>UnityException: Texture '' is not readable, the texture memory can not be accessed from 
  scripts. You can make the texture readable in the Texture Import Settings.
  </code></pre>
  
  <p>I'm thinking that I need to make it readable somehow. I googled it, but the only answers I get is to how to make it readable through the editor.</p>