Write in a file

Hi!
Someone knows how I can write in a file with Unity API?

Thanks at all

pedr0

You can’t

File Access is handled through .NET, System.IO more specifically :slight_smile:

Wow!
I explain you my problem: I’m writing an iPhone application (game) and I have to save the state of game(like players life, position etc etc), I have thought that write information in a file was a good idea, but how do this?
Any suggestion?

Thank a lot and excuse me for my english, I am a newbye for it also!

pedr0

You have two ways to do it:

Way 1: You store them through the PlayerPrefs class. Thats likely the simplest solution

Way 2: If you have more sophisticated requirements, you would use System.IO and the corresponding File commands and store your data in a format you decide yourself. The only requirement on that end is that you write it into the applications documents folder

Sorry for my ignorance, but where can I find the system I/O in Unity?I’m programming with Javascript…
I have looked for System.IO in the Unity documentation at Unity - Scripting API: but I did’nt find a description of this class, does it a .Net class?
Where can I find the documentation?
Tanks a lot for your patient :smile:

As mentioned, its a .NET feature
.NET features are documented on go-mono.com and Microsofts MSDN.

Unity only documents Unity API functionality, not the thousands of .NET functions and classes

Hi pedr0, really I don’t think you need to use .NET to do what you said you want to do, you can easily do all of this with PlayerPrefs, and it’s straight forward.

<Documentation/ScriptReference/PlayerPrefs.html>