Level remains null?

Apr 15, 2011 at 11:26 PM


I'm attempting to do the documentation example present in the videos in XNA 4.0 and the GameStateManagement sample (the code is in GameplayScreen.cs), so far so good but the issue I'm running into is my application crashes when it gets to


When I examine the issue it turns out,

        protected void Initialize()
            level = Level.FromFile("level1.xml", ScreenManager.Game.Content);

Is to blame, it basically shows up as null. The level file is present in the debug folder and the textures are all in the content folder as well so I'm not sure why it's showing up as null. The reason the code doesn't include the override part is because I get errors if I leave it in saying there was nothing found to override it.

Anyone have any ideas?


Apr 16, 2011 at 2:02 AM

There's really no easy way of telling what could be going wrong.

I'd advise you to use the debugger and step into the FromFile function and see if you can figure out why it's returning null.