I am rather new to serialization and have it working for some sections but I am running in to an issue.
The first struct:
public struct RecordPt
{
float xP;
float yP;
public RecordPt(float x, float y){
xP = x;
yP = y;
}
}
Works just fine in my serialize code:
public void WriteToXML (string path1,string path2)
{
//Serialize and write first list of RecordPt to xml
XmlSerializer serializer = new XmlSerializer (typeof(List<RecordPt>));
FileStream stream = new FileStream (path, FileMode.Create);
serializer.Serialize (stream, recordingPoints);
stream.Close ();
//Serialize and write second list of LineSeg to xml
XmlSerializer lineSer = new XmlSerializer (typeof(List<LineSeg>));
FileStream lineStream = new FileStream (path2, FileMode.Create);
serializer.Serialize (lineStream, recordingLines);
lineStream.Close ();
}
The second struct has a Vector3 Array that seems to be causing the issue.
public struct LineSeg
{
public Vector3[] pts;
public int lnColor;
public float timeP;
public LineSeg (Vector3[] ptAr, int color, float time)
{
pts = ptAr;
lnColor = color;
timeP = time;
}
}
The error I am getting is:
InvalidOperationException: The type of the argument object ‘System.Collections.Generic.List`1[[RecordMovement.SerLines, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]’ is not primitive.
Thanks in advance!
~Justin