I read the Github. I do understand the problem, and it's not a memory leak bug. It's just a careless design.
In my projects, I never use pause mode, I always handle things manually (such as with a boolean flag, is_paused
). This is the way I've always programmed, because much of my experience was before they had easily available game engines. And I like this better, because (at least in Godot) you get into weird situations where you pause the game on a pause screen, but then cannot unpause it because everything is paused. That also doesn't make much sense, so I don't use the feature.
Beyond that, I don't understand why a fresh project would work in Godot 3.4.4 but the upgraded project would not. There are cached files for resources, like in the .import folder or in your own folders with the filename.jpg.import extension, but they are only for images or assets, not code. So it seems strange there would be anything left over, though I don't fully understand the upgrade process between versions, so perhaps there is an issue I'm unaware of.
I don't use C#, so I can't give you the exact example code to work around this. I would suggest two things. One, override the Input function (and UnhandledInput, GUIInput, etc.) and attempt to manually delete/free the input events. You can see the chain here, I believe adding the override functions to the root Viewport would be the best place, GetNode("/root");
https://docs.godotengine.org/en/stable/tutorials/inputs/inputevent.html
Otherwise, you can forget about pause mode, and just set a boolean flag, like isPaused = true;
and then check for that in the relevant input functions. For example, for your player script you can do if (isPaused == true) return;
to exit the update loop. This is typically what I do. Though if you are already far into development, the Input override will be less code and easier to do without generating additional bugs.