swipe script only works once

im trying to use a script to swipe on mobile devices https://pastebin.com/qZFy3Eqz it works in another project i have but it seems to only work for the first swipe in my new project in the old one i was using booleans to trigger its methods from coroutines in my update method, but my new use case is to trigger scene changes and im really confused as to why it wont work this is what im trying to do here https://pastebin.com/Y3NLUyTs and as mentioned it works the first swipe but then does nothing any help appreciated

You need to have an instance of your swipeLevel script in each of these levels scenes you are loading. Seems like it is present in only your first scene and then when new scene loads the current instance will be destroyed and since newly loaded scene does not have that instance the swipe script is not working.

You can add DontDestroyOnLoad() to the Start() method of your swipeLevel script to keep the script persistent.

Also rather than doing a case based on scene names you can use regex to get the number at the end of the scene name, convert it to integer and then increment or decrement it based on the swipe left or right. Then build your scene name with this new integer value. The regex for it is: [0-9]{1,}$