All Questions

Community

B
Anthony Base

Reminder to remove that test function at the end of the video

I made it to the end of this series, but the hook was still clicking past the targets. I realized that I had missed a brief moment at the end where the instructor deletes this test function (the _unhandled_input function) at the very end of the video. Do so, so that you can save yourself some headache lol
  • Nathan Lovato replied
    Thanks for sharing. 🙂
  • Daniel Queiroz Porto replied

    Another option is something I learned at work and I find it pretty cool!

    On ready you can have something like this:

    func _ready():
        set_process_unhandled_input(false)
        if get_tree().current_scene == self:
            set_process_unhandled_input(true)
    

    This way you can leave the _unhandled_input there for testing purposes whenever you press F6 to run only that scene, and it will not affect the rest of the game.

    It's very usefull to test UI that needs to be populated, as I can populate it with whatever I need for testing purposes!