c# - Program Issues Going From Unity To HoloLens - Cannot convert from 'string' to 'System.IO.Stream' -
i have program written in unity using c# initializes new streamreader , proceeds read text data text file have stored in unity's resources folder. works fine when click play in unity -everything works , text read , displayed perfectly. however, when try build in order run via hololens emulator (platform: windows store, sdk: universal 10, build , run on: local machine), error: error cs1503: argument 1: cannot convert 'string' 'system.io.stream'.
i don't understand why error showing in first place constructor streamreader has overload accepts string parameter.
my code follows:
string metadata = string.format("/resources/.../metadata.txt", list); if (file.exists(application.datapath + metadata)) { using (streamreader sr = new streamreader(application.datapath + metadata)) { // .... } }
i agree others, caused diffence between mono in editor , .net compiling uwp application. try instead:
using(streamreader sr = new streamreader(new filestream(application.datapath + metadata, filemode.open)))
this should legal mono , .net code.
Comments
Post a Comment