So I’m testing my game from a build now instead of just the editor. Everything works fine in the editor, but when I build it I get an error when I try to read an XML file (don’t know if it does it with write as well, I haven’t tested that).
In the build it says
ArgumentException: Encoding name 'Windows-1252' not supported
Parameter name: name
It points me to this section of my code
public static invGamePiece LoadXML(string fileName){
using (var stream = new FileStream(fileName, FileMode.Open)){
var serializer = new XmlSerializer(typeof(invGamePiece));
return (invGamePiece) serializer.Deserialize(stream);
}
}
specifically to this line
return (invGamePiece) serializer.Deserialize(stream);
How can I fix this to work in build?
Cherno
2
Try encoding your XML file in UTF-8 without BOM. You can use Notepad++ for this, for example.