Defold on screen input: Node used in wrong scene (SOLVED)

Hi, using extension input with gamepad controller analog example.
I have world in which I use it and everything is fine till I want to restart this world, to give user retry the level again. After restarting level with monarch.show($level, { clean = true }) extension argues with /in/onscreen.lua:63: Node used in the wrong scene.

Checked what does gui script of gamepad has as listener, it have correct node url even if with restarting I unregister and register that listener from the beginning.
Cannot find where is the problem, can someone advice something please?

I’ve seen this before but don’t remember exactly where.

You might need to share your project with @britzl

“Node used in the wrong scene” happens when you have a reference to a GUI node and use the gui.* functions to manipulate it and the code runs from another GUI component than the node belongs to. This is very likely caused by the reload and onscreen.lua keeping a reference to an old node.

I’ve added an onscreen.reset() to reset the module:

2 Likes