Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am having some trouble serializing/deserializing in a little game I am doing to teach myself monogame.

Basically, I am using the gamestatemnanagement resources common to monogame (screen manager etc). Then I am serializing my screen manager component and all associated screens in the OnDeactivated method:

 protected override void OnDeactivated(Object sender, EventArgs args)
        foreach (GameplayScreen screen in mScreenManager.GetScreens())

The Save data bit is to do with something else.

Then I then override OnActivated to de serialize

    protected override void OnActivated(Object sender, EventArgs args)
        //System.Diagnostics.Debug.WriteLine("here activating");

However, when this runs it just loads a blank screen - it goes into the game initialize and the game draw method, but doesnt go down into the screens initialize or draw methods.

I have no idea why this might be - any help would be greatly appreciated. I am not the only one who has encountered this - I found this post also -

share|improve this question

I am willing to bet that you need to mark your model's tags (the ones you want anyway) with the "Serializable" Attribute tag.

I can't find anything to prove otherwise, but I am very doubtful that DeserializeState has no arguments, you likely need to point to what is being deserialized.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.