Sign in to follow this  

Xna ContentPipeline

This topic is 2847 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi ! ok, i'm having a little bit trouble with the serialization of an specific attribute. I have 2 classes: - Sprite.cs - Player.cs the Player.cs is derived from the Sprite.cs I have the PlayerReader in the Player.cs and an PlayerWriter class that should be both working correctly. since i am still a beginner i wanna start with loading only one attribute first. I choosed the Assetname for the Player's texture. (So i [ContentSerializerIgnore] all the other attributes & Properties) The problem is that the Assetname is an attribute from the Sprite.cs and my PlayerReader which is derived from ContentTypeReader<Player> is of course in my player.cs I was assuming that the Player.cs would inherit the Assetname from the Sprite.cs and that the serialization would work this way but then i get the compiler error that my Assetname is null...so obviously something isn't working well. What should i do ? do i have to give the Sprite.cs its own SpriteReader class ? i think that would be kinda ugly cause i'd have to deal with 2 .xml files only for the player object :( any suggestions ? thank you very much, Lumalalelo

Share this post


Link to post
Share on other sites
If you want to use XML to store the data you probably don't even need the reader and writer. Have you tried just using the IntermediateSerializer instead? You'll probably have to modify the XML a bit, but it's a lot easier to use.

Share this post


Link to post
Share on other sites
Thank you for the hint Machaira !
I actually want to creat objects with the help of the reader and writer.
Well the problem is kinda solved (i can serialize almost every property) but i got a new one...i have a property that sets 2 values instead of one and the compiler shouts a hell a lot of errors.
I'm forced to put the second value down...and i even don't want it to be read by the ContentSerializer but [ContentSerializerIgnore] won't work inside of an Property.

Is there something i can do ?

Share this post


Link to post
Share on other sites

This topic is 2847 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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