XML Load unauthorized access


I'm using a modified version of the script found on this site to save and load xml data to a file.


It writes the xml file just fine, but when I got to load it, I get this error.

"UnauthorizedAccessException: Access to the path '\' is denied."

This is not a networked project, it's all local. I'm not sure why access is denied. If anyone could help that would be great.

Try running as a administrator ?

For anyone that has this problem, try verifying that you access the correct file, so the path that you the streamreader is a correct one. The best way, for me, is

StreamReader streamReader = new StreamReader(Application.persistentDataPath + “/” + “filename”);

This if for c#. the string filename should be exactly the name of the file you need to access. Application.persistanceDataPath is the path where your application saves a xml file if you create one on your own. To verify it’s value just write print(Application.persistentDataPath); and it will write in the console were to go if you want to edit that xml file manually