xna - Using different ScreenManagers, and Initialize solution? -


using xna c#, have screenmanager handle backgrounds, , screenmanager2 handle menu options , pause screen. there objectmanager, have no problem yet...

in beginning of game screenmanager draws background perfectly, , screenmanager2 draws , handles main menu options beautifully. when choose play game error occurs. screenmanager should drawing loading screen, instead error "nullreferenceexception unhandled" @ my:

foreach (gamescreen screen in screenmanager.getscreens ()) screen.exitscreen ();

a method had worked fine when had 1 screenmanager, appears have problem initializing because of second one. both screenmanagers inherited drawablegamecomponent each, therefore telling game draw first, last, , in between.

i guess question is, how re initialize first screenmanager, if in conflict each other? in method causes error, i've tried:

screenmanager.initialize(); //before foreach loop screenmanager.isinitialized = true; //an attempt boolean this.initialize() in screenmanager

and many other boolean attempts... leads me ask, can disable , enable class? although inheriting drawablegamecomponent assume remove , re add???

i apologize in advance if question hard understand, hard describe...

++++++++++++++++++++++++

i figured out because of menu option belonging screenmanager2, , loading screen belonging screenmanager. painstakingly made boolean system allowed screenmanager add loading screen, itself... :/


Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -