This project has moved and is read-only. For the latest updates, please go here.

Serialization Error.

Topics: Developer Forum, User Forum
Feb 25, 2013 at 4:38 AM
Edited Feb 25, 2013 at 4:40 AM
I’m having some issues while trying to serialize the game World I have, to be more specific 2 issues:

The first issue occurs when I’m trying to serialize the world with his boundaries, whenever I run BodyFactory.CreateLoopShape(_World, GetBounds()); (Knowing that GetBound just return the Vertices of the screen) when running the serialization it throws:
An unhandled exception of type 'System.Exception' occurred in FarseerPhysicsXNA.dll

If I don’t had the boundaries the world will serialize.

Also whenever I try to add a body in this way:
Let’s say I have the Class Entity
public class Entity

And I also have Soldier who extends from Entity.
public class Soldier : Entity

And a 3rd class:
public class EntityType
    public int x;
    public Entity Data;
    public EntityType(int _X, Entity _Data)
        x = _X;
        Data = _Data;
If I try to serialize a world with a body whose userdata = new EntityType(1, new Soldier());
It will throw:
There was an error generating the XML document.
But if the body has as userdata = new EntityType(1, new Entity());
It will serialize.

I don’t understand the cause of this errors, can somebody explain me why this result and how to fix it?
Thanks for taking your time Reading.