Did you check if GamePlay is null before the cast?
Basicly you can do the cast using
Code:
maddox.game.GameDef game = (maddox.game.GameDef)GamePlay;
- this will cause a exception if cast fails
or
Code:
maddox.game.GameDef game = GamePlay as maddox.game.GameDef;
- this will return null if cast fails.
I tried both and both did work. Of course I still get the serialization exception.