Easy way to write and read some Transform to a text file in Unity3d?
<p>This is strictly in Unity3D, I have an array of 100 <code>Transform</code>,</p>

<p>I want to write those to a file on the PC desktop, and later read them.</p>

<p>Consider ...</p>

<pre><code> // write to desktop...
 string s = "";
 for ( int i=0; i&lt; sendMe.Length; ++i )
    {
    Transform tt = sendMe[i].transform;
    s = s +tt.position.x +"," +tt.position.x +"," ...etc... "\n";
    }

 string d = System.Environment.GetFolderPath(
     System.Environment.SpecialFolder.DesktopDirectory);
 string path = System.IO.Path.Combine(d, "happyData.txt" );

 System.IO.File.Delete(path);
 System.IO.File.WriteAllText(path,s);
 return;
</code></pre>

<p>.. and then read it similarly, just manually parsing the text format. Something like...</p>

<pre><code>public ReadTrackFromDesktopFile()
  {
  GetSplineGetReady("development");
  string tt = File.ReadAllText( .. path as above);
  List&lt;string&gt; ts = new List&lt;string&gt;(
    tt.Split(new string[] { "\r","\n" },
    StringSplitOptions.RemoveEmptyEntries) );
  foreach (string t in ts)
    {
    string[] parts = t.Split(',');
    Vector3 pos = new Vector3(parts[0],parts[1],parts[2]);
    Quaternion rot = new Quaternion(parts[3],parts[4],parts[5],parts[6]);
    GetSplineOneNode(pos, rot);
    }
  GetSplineFinalise();
  }
</code></pre>

<p>But this seems naive. What's the "simple Unity way" to do this?</p>