Code:
public class Vector3_Serializer : ICustomSerializer
{
public void Serialize(object objecttoserialize, BindingFlags flags, int Rekursion, Export_Import.SerializationData sData)
{
Vector3 v = ((Vector3)objecttoserialize); // we need to cast our object to the desired type
sData.mExportString.Append(v.x+","+v.y+","+v.z); //sData.mExportString is the export string add to it by using the Append method
}
public object Deserialize(Type objectType, string source, int Rekursion, Export_Import.SerializationData sData) //Implement deserialization method
{
var result = source.Split(',');
return new Vector3(float.Parse(result[0]),float.Parse(result[1]) ,float.Parse(result[2]));
}
}