I save several images to the temporaryCachePath, but when I go to load them, WWW can not find the file. I first verify that the file exists with File.Exists(). This only happens on my computer, where I have moved the AppData folders
Code:
filename = Application.temporaryCachePath + "/Logos/" + filename;
filename = Path.ChangeExtension(filename, ".png");
if (File.Exists (filename)) {
//Debug.Log("Loading logo " + counter + " from cache");
using (WWW www = new WWW("file://" + filename)) {
yield return www;
if (www.error != null)
Debug.Log ("WWW download had an error:" + www.error);
Texture2D t = new Texture2D (1, 1);
www.LoadImageIntoTexture (t); // Error here
Stores.currentBuildingsInfo [counter].logoTexture = t;
gameObject.renderer.material.mainTexture = t;
}
}
Error:
You are trying to load data from a www stream which had the following error when downloading.
Couldn't open file /Users/JREF01~1.MIT/AppData/Local/Temp/appname/Logos/logo06.png
UnityEngine.WWW:LoadImageIntoTexture(Texture2D)
<LoadAssetBundleFromServerOrCashe>c__IteratorC:MoveNext() (at Assets/Scripts/WWWTextureLoader.cs:38)