- Home /
System.IO don't work on android
I have to load some txt file's in my game and I was using System.IO to do that with commend System.IO.ReadAllLines and it works completely fine on computer in unity but don't work after building on samsung with android so please what should I do or what I can use instead system.IO to read txt file's on smartfon's and it would be great if it work also with telefon's with ISO, thanks
Answer by Positive7 · Aug 06, 2015 at 09:27 PM
System.IO should work fine in Android. however PC and Android stores files in different location. So you might want to check that out or post some piece of the relevant script.
I red that I have to move file's to Resources file so my location path's look are:
string path_poziom_pierwszy = @"Resources/poziom_pierwszy.txt";
string path_poziom_drugi = @"Resources/poziom_drugi.txt";
string path_poziom_trzeci = @"Resources/poziom_trzeci.txt";
then I use this to turn txt file into a string table because in specific line I have specific numbers
poziom_pierwszy = System.IO.File.ReadAllLines(path_poziom_pierwszy);
poziom_drugi = System.IO.File.ReadAllLines(path_poziom_drugi);
poziom_trzeci = System.IO.File.ReadAllLines(path_poziom_trzeci);
what may be wrong with direction?
so I'am using: using System.IO;
$$anonymous$$y location path's are:
string path_poziom_pierwszy = @"Resources/poziom_pierwszy.txt";
string path_poziom_drugi = @"Resources/poziom_drugi.txt";
string path_poziom_trzeci = @"Resources/poziom_trzeci.txt";
I have in Awake function this:
poziom_pierwszy = System.IO.File.ReadAllLines(path_poziom_pierwszy);
poziom_drugi = System.IO.File.ReadAllLines(path_poziom_drugi);
poziom_trzeci = System.IO.File.ReadAllLines(path_poziom_trzeci);
On computer it works fine but on android it won't work at all. What's wrong with my resources file, help, thanks
It's because they're in Resources folder The file doesn't exist there the same way as in the project http://wiki.unity3d.com/index.php/Special_Folder_Names_in_your_Assets_Folder#.22Resources.22
you could try to use : Resources.Load(); or WWW should work too.
Sorry for delayed answer