Hi,
I placed a configuration file in Assets/Resources.
Then I try to read it using the following path:
string path=Application.dataPath+“/Resources/Stats.yaml”;
StreamReader reader = File.OpenText(filename);
I can’t seem to find the file once I build the players though. What am I doing wrong?
I thought the Assets/Resources directory was packaged with the game?
unless its recognized as text asset it won’t be included in the build actually.
You can just include a text file in the Unity project (it must have a .txt suffix, though) and access it using the TextAsset class. The text of the file is accessed as a string; there is a constructor for StreamReader that accepts a string as the “stream”, so there should be no problem if your YAML processor needs a StreamReader for input.
Ah… I misunderstood what the Resources directory meant.
Thanks andeeee, dreamora!