Making a folder at Applications folder

In my game, I will like a script that can make a folder at the Applications folder on a Mac to store .txt files in.
I looked around, but I could’t find a solution on the forums.

A google search returns: http://answers.unity3d.com/questions/52401/creating-a-directory.html http://answers.unity3d.com/questions/193211/how-to-create-a-directory-.html Searching directly on the forums is never a good idea, google is your friend, please be his too!!!

Lol i did use google

Did you find the same answers to your question? :)

Actually, yes. Thanks!

Why would you want to store text files in a folder inside Applications. OSX has lots of other places to store files. ~/Application Support/{your company}/{your app} comes to mind.

2 Answers

2

Sounds like you just need to use an Environment variable from C# and an absolute path. From there, you can make sure to check that the directory exists, and then proceed to write your text files; later, you can read them in using a similar process. I believe Mono supports a similar adaptation of the .NET System.GetEnvironmentVariable() method.

If you want to create files at runtime in your game then I would recommend using the persistent data path which can be found using Application.persistentDataPath.

This works for mobile and desktop platforms, but does not work for the web player.