- Home /
Trouble with save file
I'm having a bit of trouble with saving and loading, I'm using XML files to save the game and i want my game to pull name of the character from the XML file to label the character slots, the trouble is i don't know how to go about doing that in C#. can anyone help?
Answer by $$anonymous$$ · Apr 24, 2012 at 08:06 AM
I you just want to save a name, you could also use PlayerPrefs :
http://unity3d.com/support/documentation/ScriptReference/PlayerPrefs.html
To save using XML files, you could use System.Xml.Serialization.XmlSerializer
.
For example, create a class representing the player character et serialize an instance into a xml file. When you want to load, deserialize it to get the instance back.
http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlserializer.aspx
The main problem of using xml file is that it is really easy for players to cheat, because it easy to edit a savefile written in xml.
this is what i was originally going to do but i was having trouble with making multiple save stat, although t i think i have figured that out.
Your answer
![](https://koobas.hobune.stream/wayback/20220613070700im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Load file on Android 1 Answer
Save and Load from XML help 1 Answer