Tip when using nifty tutorial to make custom screen control

The tutorial I’m referring to is: https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:nifty_gui



I followed the tutorial, added my own screen-controller but nifty didn’t find it, according to logger, so it was replaced with default. If someone else had that problem here’s what you can do. Very small change.



You do everything the tutorial says, how to set up the controller etc. But don’t do this:



// init Nifty start screen

nifty.fromXml(“Interface/helloworld.xml”, “start”);



Instead, instantiate the controller (somewhere above that line):



MySettingsScreen mySettingsScreen = new MySettingsScreen();



and change the line into this:



nifty.fromXml(“Interface/helloworld.xml”, “start”, mySettingsScreen);



Don’t know why I’m having this issue, didn’t dig any deeper. Maybe a classloader thing. Anyways, after doing that it works and i’ve had no problems since.



/Cheers