Reading a Text File in the Assets Folder

Currently I have a “road.txt” file in my Assets folder of my project inside unity.

In the Editor if I hit “Play” all is well … I am using Stream Reader to read my text file in and do what I want with it.

var reader = new StreamReader(@"Assets/road.txt");

Nothing crazy going on here … Now When I deploy to the Windows Phone I get a FileNotFoundException is there another way I should be referencing the file inside my script?

The error in the Console window on the Phone states a file path of “C:\Data\Programs{some_guid_for_the_app}\Install\Assets\road.txt”

Is there a variable in the Unity Engine I should be using to reference a .txt/whatever file inside my assets folder in my unity 3d project?

Thanks for any heads up on this. :stuck_out_tongue: :o :slight_smile:

Check out - Unity - Manual: Streaming Assets

Thanks!!! I Created the “StreamingAssets” folder and it now works on all platforms I have tried … Bookmarked that page as well for future references.