Skip to main content
deleted 130 characters in body; edited title
Source Link
user1430
user1430

Loading, opening, and then saving to How can I save an xml document inXML file with Unity on the Android platform?

I am writing a game that has a save function which looks like this

    public void Save()
    {

        System.Xml.Serialization.XmlSerializer ser = new System.Xml.Serialization.XmlSerializer(this.GetType());
        System.IO.StreamWriter file = new System.IO.StreamWriter(("Assets/Resources/Save");
         ser.Serialize(file, this);
        file.Close();
    }
}

This will work fine in the editor and on windowsWindows machines, but when we build to androidAndroid the saving no longer works. Loading the file we have no problem we are using a Textasset but they are read only so whatWhy is wrong and why wont this open the file on android.that?

Loading, opening, and then saving to an xml document in Unity on Android

I am writing a game that has a save function which looks like this

    public void Save()
    {

        System.Xml.Serialization.XmlSerializer ser = new System.Xml.Serialization.XmlSerializer(this.GetType());
        System.IO.StreamWriter file = new System.IO.StreamWriter(("Assets/Resources/Save");
         ser.Serialize(file, this);
        file.Close();
    }
}

This will work fine in the editor and on windows machines but when we build to android the saving no longer works. Loading the file we have no problem we are using a Textasset but they are read only so what is wrong and why wont this open the file on android.

How can I save an XML file with Unity on the Android platform?

I am writing a game that has a save function which looks like this

    public void Save()
    {

        System.Xml.Serialization.XmlSerializer ser = new System.Xml.Serialization.XmlSerializer(this.GetType());
        System.IO.StreamWriter file = new System.IO.StreamWriter(("Assets/Resources/Save");
         ser.Serialize(file, this);
        file.Close();
    }
}

This will work fine in the editor and on Windows machines, but when we build to Android the saving no longer works. Why is that?

edited tags
Link
Tucker Morgan
  • 847
  • 2
  • 12
  • 16
Source Link
Tucker Morgan
  • 847
  • 2
  • 12
  • 16

Loading, opening, and then saving to an xml document in Unity on Android

I am writing a game that has a save function which looks like this

    public void Save()
    {

        System.Xml.Serialization.XmlSerializer ser = new System.Xml.Serialization.XmlSerializer(this.GetType());
        System.IO.StreamWriter file = new System.IO.StreamWriter(("Assets/Resources/Save");
         ser.Serialize(file, this);
        file.Close();
    }
}

This will work fine in the editor and on windows machines but when we build to android the saving no longer works. Loading the file we have no problem we are using a Textasset but they are read only so what is wrong and why wont this open the file on android.