I have a program written in Unity using C# that initializes a new StreamReader and proceeds to read the text data from a text file I have stored in Unity's resources folder. Everything works fine when I click play in Unity -everything works and the text is read and displayed perfectly. However, when I try to build it in order to run it via the HoloLens emulator (Platform: Windows Store, SDK: Universal 10, Build and Run On: Local Machine), I get the error: error CS1503: Argument 1: cannot convert from 'string' to 'System.IO.Stream'.
I don't understand why this error is even showing up in the first place as the constructor for a StreamReader has an overload that accepts a string parameter.
My code is as follows:
string metadata = String.Format("/Resources/.../metadata.txt", list);
if (File.Exists(Application.dataPath + metadata))
{
using (StreamReader sr = new StreamReader(Application.dataPath + metadata))
{
// ....
}
}