jmonkeyengine icon indicating copy to clipboard operation
jmonkeyengine copied to clipboard

If you do not load default settings the flyCam will be equal null

Open AlexandrPutenikhin opened this issue 1 year ago • 2 comments

public static void main(String[] args) {
        Battletown app = new Battletown();
        
        AppSettings settings = new AppSettings(false);
        settings.setFullscreen(true);
        
        app.setSettings(settings);
        
        app.setShowSettings(false); //Settings dialog not supported on mac
        app.start();
    }
flyCam.setEnabled(false);
SEVERE: Uncaught exception thrown in Thread[jME3 Headless Main,5,main]
java.lang.NullPointerException: Cannot invoke "com.jme3.input.FlyByCamera.setEnabled(boolean)" because "this.flyCam" is null
	at com.waystudio.Battletown.simpleInitApp(Battletown.java:31)
	at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:240)
	at com.jme3.system.NullContext.initInThread(NullContext.java:102)
	at com.jme3.system.NullContext.run(NullContext.java:146)
	at java.base/java.lang.Thread.run(Thread.java:833)

AlexandrPutenikhin avatar Dec 10 '23 16:12 AlexandrPutenikhin

I think you will find that it isn't the only thing wrong... just the first bad thing to happen.

A clue: "com.jme3.system.NullContext"

Another clue: "Thread[jME3 Headless Main"

...JME thinks it's running in headless mode because you haven't setup the renderer and the other things that need to be manually set when you tell the settings not to use the defaults.

Is there a reason you are telling it not to use defaults?

pspeed42 avatar Dec 10 '23 16:12 pspeed42

@AlexandrPutenikhin if you don't wish to continue the conversation, please close this issue.

stephengold avatar Dec 13 '23 02:12 stephengold