Problems with stateManager

i seem to be having some issues with AppStateManager in jme. I extended application and updated the stateManager after my subclass update and updated the render after the rendermanager. I then simply attach what needs to be attached to it however I have been having issues with it all day.



Originally i also placed stateManager.cleanUp() in the stop method before calling super.stop(). It seems when the stop method is called simultaneously calling stateManger's cleanUp method that initialization of all attached appStates are called a second time. While it really wasn't an imminant issue i figured it could cause issues down the road so i took the cleanUp method out of the over-riden stop method.



Another issue that i was having was that nifty doesn't exactly have a way to hide the gui except for exiting it which means it needs to be recreated as calling nifty.fromXML() afterwards does not seem to help. A way around this i figured would be to detach or reattach nifty from the guiProcessor when needed. Instead of creating a separate method I decided to include it in the stateAttached() or state detached() methods; however it never worked correctly originally i had thought that the methods would be called once however i was having issues so i decided to println an integer and found it was called 23 times once in the begining and 22 times sometiems later.



Are these effects intended or could it be that something isn't set up correctly



when i take the stateManager.update() method out of update the app states do not update so i figured those few calls i got right…