Without any references to your script it will be very hard to find the problem.
In the title you talked about using nintendo switch, perhaps thats whats giving you problems?
I’ve experimented with it and found that it does not have anything to do with the script. I can recreate the issue with a completely blank project. (When I mentioned trying it in a game, it was in the ‘Dodge the Creeps’ demo)
It is just that the engine itself is giving weird inputs.
As a side note: I found that disabling steam causes Godot to not even detect the Nintendo Switch Pro Controller
My Nintendo switch controller works fine for me on my PC, although I’m using an 8BitDo dongle for the connection, where as it sounds like you’re relying on Steam Input for connectivity.
Assuming that’s the case, then have you tried reconfiguring the controller in steam, and/or adding your Godot game as a non-steam game?
Alternatively, I think you can use BetterJoy to configure a Switch controller as an XInput device, which should remove the need for Steam or an external dongle.
Edit: I’m not 100% on any of this, and apologies if this is wrong or teaching you to suck eggs, but I think the switch controllers aren’t supported natively in Windows and need a translation layer to convert them to Windows default controllers (e.g. XInput controllers) or equivalent.
For anyone trying to solve it in the future, BetterJoy was the solution. It did take a little bit of fiddling, but if you follow the instructions, it’ll work.