Cant read txt files in Assets folder when run on device

hello,

i have a game where i read txt files inside the Assets directory via StreamReader.

unfortunately this doesnt work on the mobile device. it fails with a file not found error. everything else works fine though.

02-19 12:21:35.890: I/Unity(29946): IsolatedStorageException: Could not find a part of the path "/Assets/Levels/enemies.txt".
02-19 12:21:35.890: I/Unity(29946):   at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) [0x00000] in <filename unknown>:0 
02-19 12:21:35.890: I/Unity(29946):   at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share) [0x00000] in <filename unknown>:0 
02-19 12:21:35.890: I/Unity(29946):   at System.IO.File.OpenRead (System.String path) [0x00000] in <filename unknown>:0 
02-19 12:21:35.890: I/Unity(29946):   at System.IO.StreamReader..ctor (System.String path, System.Text.Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize) [0x00000] in <filename unknown>:0 
02-19 12:21:35.890: I/Unity(29946):   at System.IO.StreamReader..ctor (System.String path) [0x00000] in <filename unknown>:0 
02-19 12:21:35.890: I/Unity(29946):   at Load.loadEnemies () [0x00000] in <filename unknown>:0 
02-19 12:21:35.890: I/Unity(29946):   at Load.Start () [0x00000] in <filename unknown>:0

thanks!

There is no separate Assets folder in a build, that’s something which only exists in the editor. Don’t bother with System.IO, just use TextAsset.

–Eric

use the resources folder