Godot Forums
  • Godot Engine
  • Rules
  • About
  • Featured Projects
    • Godot Help2DProgrammingGodot 4.X
    • button pressed signal

    • Original Post
      1 of 4 postsAugust 2023
      0 unread
      Now
    • Ggemmomoh

      • Aug 27, 2023
        Post #1 Sunday, August 27, 2023 7:00 PM

      Hey, I was wondering why this doesn't work, can someone explain why?

      • retroshark replied to this.
        • LoipesMas

        • Aug 27, 2023
          Post #2 Sunday, August 27, 2023 7:09 PM
        • Best Answerset by retroshark Aug 27, 2023

        In the docs for BaseButton you can see that pressed is a signal. What you want is probably button_pressed property.
        However, I generally recommend using signals and callbacks instead. Those are explained here

        • LoipesMas

        • Aug 27, 2023
          Post #2 Sunday, August 27, 2023 7:09 PM
        • Best Answerset by retroshark Aug 27, 2023

        In the docs for BaseButton you can see that pressed is a signal. What you want is probably button_pressed property.
        However, I generally recommend using signals and callbacks instead. Those are explained here

        • retroshark

        • Aug 27, 2023
          Post #3 Sunday, August 27, 2023 7:49 PM
        • Edited

        gemmomoh Yo yo! As @LoipesMas mentioned, you are trying to reference a signal without attaching it. I would suggest reading up on signals in Godot. Once attached to the script you will be able to have the line print("pressed") and it will work as intended.

        Edit: Marking @LoipesMas reply as the best answer.

          • Ggemmomoh

            • Aug 28, 2023
              Post #4 Monday, August 28, 2023 8:25 PM

            Thank you both for the explanation.

            Loading...
            Something went wrong while trying to load the full version of this site. Try hard-refreshing this page to fix the error.