Writing this here so I can find it quickly: –

using System.IO;
using System.Xml.Serialization; 

[Serializable]
public class SaveData
{
    public string title;
}

XmlSerializer ser = new XmlSerializer(typeof(SaveData));
TextWriter writer = new StreamWriter(Path.Combine(Application.persistentDataPath, "data.xml"));
ser.Serialize(writer, m_data);
writer.Close();
Advertisements