Now i’m working on a project which created by others. I need access image files stored in StreamingAssets folder. This is my C# code below:
IEnumerator Start () {
_image = gameObject.GetComponent <RawImage>();
string url = "file://" + System.IO.Path.Combine (Application.streamingAssetsPath, name);
WWW www = new WWW(url);
yield return www;
if (www.error == null)
{
_image.texture = www.texture;
}
else
{
Debug.Log ("[test] error : " + www.error);
}
}
I can totally make sure the file is right there. And it’s working perfect when i run on Unity Editor. But it shows “Unsupported URL” after i build as ios and run at my ios device.
I am confused for this question for a long time. So I decide to do a test by creating a totally new project and add a new scene, a new script, a png image. It’s working perfect when i run on iPhone after build it.
And now i do not know how to find the source of this question. Hope someone can help me. Thanks in advance.