- Home /
Question by
imilanspinka · Aug 03, 2015 at 01:55 AM ·
filefilepathtextfile
Create a text file in %AppData%/AppName
When I try
File.WriteAllText("%AppData%/AppName", arg2);
The file is created in UnityProjects/AppName/%AppData%/AppName, not C:/Users/Username/AppData/Roaming/AppName/.
Thanks for help.
Comment
Best Answer
Answer by Dave-Carlile · Aug 03, 2015 at 01:58 AM
I don't think things like %appdata% are expanded out when using file functions, but I've admittedly never tested that. You can build the path with Application.persistentDataPath. That will work consistently across platforms as well.