Closed huayunliufeng closed 5 months ago
And, call getInput(). clearAll(); The method seems to have little effect.
Hi,
If you are adding JavaFX event handlers, then you can remove them in the same way.
getInput().removeEventHandler(...);
Yes, my problem has been resolved
There is now a scenario where the binding input by the user is not completed in the initInput method, but is implemented in the game control logic. For example, in a custom new game menu, there is code like this:
FXGL.getGameController().startNewGame(); ChessController.getInstance().startNewGame();
In the startNewGame method, I bound input events:Now, if I press ESC in the game and select to start a new game, the events bound to it will not be cleared, and I will be prompted to have the same event binding. May I know where the problem lies with me?