Hi all
Im getting the classic error:-
I know normally you put (int) / (string) / (GameObject) etcto create the cast but this time I just don’t understand how to fix it…
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.IO;
using System.Xml;
using System.Xml.Serialization;
public class xmltest1 : MonoBehaviour {
public class ShipCollection
{
public Ship[] Ships;
}
public class Ship
{
[XmlAttribute ("id")]
public string Shipname;
}
public static void XML(){
FileStream fs = new FileStream("data.xml", FileMode.Open);
ShipCollection ships;
XmlSerializer serial = new XmlSerializer(typeof(ShipCollection));
ships = serial.Deserialize(fs); //This line causes the error
}
}
The declarations at the top which ones do I actually need to just do some XML testing…Ive managed to confuse myself abit after trolling through forums/examples etc etc
Cheers for any help.
Regards,
John