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())
{
DataManager.SaveData(screen.Level.LevelData);
}
mScreenManager.SerializeState();
}
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");
mScreenManager.DeserializeState();
}
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 - https://monogame.codeplex.com/discussions/391117