File IO or data recording / working with other applications

I wonder what folks are using to store data (user scores, level progress etc.) if there is some similar approach to file IO or a user pref file that can be used to store some amount of data about game progress.

Also is there any system for calling other applications (eg open “sesame.exe”) or the like via the standalone app?

– Al

Hi Al. Welcome to our forum.

For preferences you usually just use the PlayerPrefs class:
http://unity3d.com/Documentation/ScriptReference/PlayerPrefs.html

For launching any process you use one of the .NET classes.
In this case System.Diagnostics, essentially this lets you run anything like you can from the terminal.

System.Diagnostics.Process.Start(“sesame.exe”);

Can you tell me where the data is then stored? Is is some sort of registry entry? Also, is there any limit on the amount of data which may be stored?

Is the approach to launching an app on a mac different?

Finally, is the norm then to say… pull the data out of an array by type and then populate prefs by name-then reverse the process to get an internal array of userdata? I guess theres an array to string (join) but I haven’t seen any string manipulation functions - things like charAt[ ], or string comparisons - are these done via .NET as well?

–al

The preferences are stored differently on Mac OS X and on Windows, so I recommend to treat it as an internal storage for the game only.

For general file IO, use the .Net standard library: How to: Read Text from a File, How to: Write Text to a File

For string manipulation methods, see the documentation for the String class.

On Os X preferences are stored in
~/Library/Preferences/unity.CompanyName.ProductName.plist

CompanyName and ProductName is set in Edit → Project Settings → Player.
(It defaults to your system wide defaults for company name and the name of the project folder)

On windows the preferences are stored in the registry witha similar scheme using CompanyName and ProductName.