Unity can not access StreamingAssets on IOS
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.
Answer by GMonks-Entertainment · Mar 13, 2017 at 01:24 PM
You do not need to add "file://" prefix in url .
Your answer
Follow this Question
Related Questions
Download images and apply to sprite 0 Answers
UnauthorizedAccessException iOS Loading an Image/Texture From Streaming Assets 1 Answer
Share to facebook, twitter,etc. Ios Please help out 0 Answers
On Demand Resources downloads data but can't access to it. 0 Answers
who own a game made by unity 1 Answer