Sign in to follow this  
alexhotte

[XNA] Intermediate Serializer not writing all the data.

Recommended Posts

So i'm having this problem for a while and don't know where to look.

I'm using Microsoft.Xna.Framework.Content.Pipeline.Serialization.Intermediate to serialize / deserialize a few things, and so far it worked great.

But now, i did a level editor and it doesn't seem to write the data properly for my tiles. All i get is:

[code]<XnaContent xmlns:WorldClasses="XRpgLibrary.WorldClasses">
<Asset Type="WorldClasses:MapData">
<MapName>Village</MapName>
<Layers>
<Item>
<MapLayerName>Base</MapLayerName>
<Width>32</Width>
<Height>32</Height>
<Layer>
<Item />
<Item />
<Item />
<Item />[/code]


As you see, the Item fields are all empty when they should contain some tile values. Everything else works perfectly.

Even if i debug my game step by step, i can see that the right data is passed to the Serializer; it just doesn't seem to write them! :S (Check screenshot at the end)

Here's my Tile class, just in case:

[code]using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace XRpgLibrary.TileEngine
{
public class Tile
{

#region Field Region

int tileIndex;
int tileSetIndex;

#endregion

#region Property Region

private Tile()
{
}

public int TileIndex
{
get { return tileIndex; }
private set { tileIndex = value; }
}

public int TileSetIndex
{
get { return tileSetIndex; }
private set { tileSetIndex = value; }
}

#endregion

#region Constructor Region

public Tile(int tileIndex, int tileset)
{
TileIndex = tileIndex;
TileSetIndex = tileset;
}

#endregion
}
}[/code]


[img]http://i.imgur.com/QIKZA.jpg[/img]

So anyway, as you can see, the data is passed properly and in that case, should have these values in XML:


<Item>
<TileIndex>1</TileIndex>
<TileSetIndex>0</TileSetIndex>
</Item>


So i know it's a lengthy post, but i'm pulling my hair at this. If anyone has any ideas, please let me know!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this