- Home /
Using Application.StreamingAssetsPath correctly
Hey!
I'm trying to load a file from the assets folder into my project. In order to have it working as well on Android as on PC and iOS i thought I need to use Application.StramingAssetsPath.
My Code looks like this:
//Assign the Path to the variable
aPathToFieldFilesAndroid[0] = System.IO.Path.Combine(Application.streamingAssetsPath, "Data/testField.txt");
The code in which i try to load the file looks like this:
if (pathToFile.Contains ("://")) {
WWW www = new WWW (pathToFile);
pathToFile = www.text;
}
TextAsset tmpText = Resources.Load (pathToFile) as TextAsset;
String[] aRows = tmpText.text.Split(new string[] {"\r\n", "\n"}, StringSplitOptions.None);
Whenever i try to run it on PC., it just tells me that it cannot find the file. (NullReferenceException).
I hope you can help me with that problem, it really bugs me..
Thanks in advance!
Your answer

Follow this Question
Related Questions
RTS Game Assets / Objects. Best approach? 0 Answers
Accesing StreamingsAssets in android (LitJson) 1 Answer
How do I get into my StreamingAssets folder from the various platforms? 5 Answers
How can I load a mp4 from a website to use as a Movie Texture at runtime? 0 Answers
Moving entire object (with it's scripts and triggers) into a different project. 2 Answers