- Home /
Problem using StreamingAssets on Android build
Hey guys.
Here's the thing: I need to retrieve a file from streamingAssets folder after the build, but I tried every path that documentation and foruns tells to try and It seens that it can't find the file. I made a PC build, and using the code below it worked nice, but on the android build not.
public WWW wwwFile
public IEnumerator initialize()
{
string path = "file:///"+Application.streamingAssetsPath + "/savedPatterns.gd";
string uin = debugger.text;
debugger.text = uin+" On Windows"+"\n" ;
if(Application.platform == RuntimePlatform.Android)
{
path = "jar:file://" + Application.dataPath + "!/assets/"+"savedPatterns.gd";
debugger.text = uin+" On Android"+"\n" ;
}
if(File.Exists(path))
{
debugger.text = debugger.text+" File exists"+"\n" ;
wwwFile = new WWW(path);
while(!wwwFile.isDone)
yield return null;
}
else debugger.text = debugger.text+" File don't exist"+"\n" ;
}
I tried "jar:file://" + Application.dataPath + "!/assets/"+"savedPatterns.gd"; Application.streamingAssetsPath + "/savedPatterns.gd";
and some others and nothing. On android build always point that file don't exist. Can someone help me out?
Thanks in advance.
"jar:file://" + Application.dataPath + "!/assets/"+"savedPatterns.gd"; Application.strea$$anonymous$$gAssetsPath + "/savedPatterns.gd"; Why "!/assets/" ? Why adding a « ! » ?
If I'm not mistaken, you have to manually extract by code the file from your apk and copy it onto somewhere, then read it
Have you enabled permission to write on sd card? $$anonymous$$aybe that may change something
Unity Docs mentions that "!" sign in that link. And I'm also trying to find the answer to this question.
Have you looked at their example?
Your answer
Follow this Question
Related Questions
I can't figure out how to use www to copy a file / very confused about porting to android... 0 Answers
Streaming Assets android 0 Answers
how do you correctly copy a jpg file from streaming assets folder using www? 1 Answer
In Unity 4.1 www.isDone doesn't seem to work in Android. Any suggestion? 0 Answers
Loading an image from streamingassets fails every time on Android 1 Answer