Unfortunately, there is no simpler way. These classes do not use the generic " Disposable " interface or anything like that to do this automatically. Everything that the dispose() method has must be removed manually when it is no longer needed.
This is true for Screens . When switching Screens they are not automatically deleted, but you need to do it yourself (before calling Game.setScreen() ).
On the other hand, it does not really matter. Just browse through your Screen and see if you need to dispose of it or not. If there is a dispose method, name it in dispose() Screen .
BUT this does not explain your behavior regarding the invisible buttons from the last Screen . Suppose you use Stage and use Gdx.input.setInputProcessor(stage); . This parameter will not be changed when the screen changes, and you must set the input processor to the Stage your current Screen or to what processes the input in the current Screen . Thus, the "old" scene will no longer capture any inputs.
noone
source share