I’ve got a trouble: suddenly flyCam and inputManager inside simpleInitApp() both became equal to NULL.
I don’t understand what happened! They are ALWAYS NULL!
public void simpleInitApp() {
Box b = new Box(1, 1, 1);
System.out.println("inputManager = " + inputManager + "; flyCam = " + flyCam);
Geometry geom = new Geometry("Box", b);
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", ColorRGBA.Blue);
geom.setMaterial(mat);
rootNode.attachChild(geom);
}
Output: inputManager = null; flyCam = null
All my examples (I did a lot of samples by jMonkey Book) throws NullPointer exceptions now (they worked before). I tried to:
reinstall jMonkey SDK and clean Windows registry
reinstall video drivers
… nothing helps…
I don’t understand what I actually had done… As far as I remember I just had written this:
private final InputListener flyCamListener = new ActionListener() {
@Override
public void onAction(String name, boolean isPressed, float tpf) {
boolean enabled = app.getFlyByCamera().isEnabled();
app.getFlyByCamera().setEnabled(!enabled);
}
};
I guess I solved the problem. On one of the forums I found and included to NEW project such a section:
Main app = new Main();
AppSettings settings = new AppSettings(true);
settings.setRenderer(AppSettings.LWJGL_OPENGL_ANY);
settings.setResolution(640, 480);
settings.setFrameRate(30);
app.setSettings(settings);
app.start();
… and everything started to work! Including all of my previous applications that unexpectedly began to crush.
So I think the key point is setRenderer() method. I remember I had launched my disastrous application without such a line and probably jMonkey “saved” settings for the sake of itself.
So WHY JMONKEY KEEPS ITS UNSTABLE SETTINGS GLOBALLY AND PERMANENTLY? All of other applications crush, reinstalling SDK doesn’t help and so on!
Because the all have the same title and so share the same stored preferences… though really relying on JME for that is hit or miss. (This may have been fixed in 3.1 since I seem to have to specifically load my settings now.)
Set a title for your app in the app settings and they will use different stored settings.
Edit: actually it would be helpful to see one of the classes that is failing’s main method and not just the one method that is failing.