@Override
    public void cleanup() {
        super.cleanup();

        if (app.getInputManager() != null) {
            flyCam.unregisterInput();
        }
    }
This is called by SimpleApplication during initialize().
jme3-core/src/main/java/com/jme3/app/FlyCamAppState.java