Input Debug not removed when Input cleared from GameObject #6137
Closed
Description
Version
Phaser 3.6 beta
Description
When debug is enabled on a game object input and then the input is subsequently cleared, any debug object is left hanging.
Additional Information
I have been testing a fix for this, which works, but I'm not sure if this is the best way. Needs someone with a better system overview to approve.
I'm simply removing the debug in InputPlugin.clear() before the gameobject reference is released, eg
// If GameObject.input already cleared from higher class
if (input)
{
input.gameObject.scene.input.removeDebug(input.gameObject); // <-- this line added
input.gameObject = undefined;
input.target = undefined;
input.hitArea = undefined;
input.hitAreaCallback = undefined;
input.callbackContext = undefined;
gameObject.input = null;
}