XNA Monogame GameState Management not deserilaizing
Posted
by
Pectus Excavatum
on Game Development
See other posts from Game Development
or by Pectus Excavatum
Published on 2013-12-06T14:41:51Z
Indexed on
2014/06/05
3:41 UTC
Read the original article
Hit count: 225
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
© Game Development or respective owner