This is the testing Godot forums! All forum posts unique to this forum will be deleted! Please use the main forums here for any posts you want to keep. All forum rules still apply.

Button nodes aren't responding to mouse clicks, could someone help me out?

BlackAxolotlGamesBlackAxolotlGames Posts: 3Member

I'm creating my Title screen for my game and the buttons I'm using for it aren't responding to mouse clicks but do respond if shortcuts are specified for them. I've tried searching around before asking this question and couldn't find an answer to my problem.
For reference here is my node structure:

the code on my title screen:

and the code on my buttons:

Best Answer

  • Accepted Answer

    So I eventually found the issue, the issue I was having was I was autoloading a scene that had a canvas layer covering the whole screen and that was what was blocking the buttons from being clicked. after removing the canvas layer and restructuring that scene, all of my buttons were clickable

Answers

  • TwistedTwiglegTwistedTwigleg Posts: 2,561Admin

    Welcome to the forums @BlackAxolotlGames!

    If I had to guess, it is probably the Fade In node blocking the mouse cursor. I don't remember what the setting is right off, but there should be a setting called something like mouse filter that you can set that will allow input events from the mouse to pass through it, which should fix the issue.

  • BlackAxolotlGamesBlackAxolotlGames Posts: 3Member

    Thanks for the welcome @TwistedTwigleg

    I worked on changing the mouse filters in every possible way I could and there were no changes
    I've narrowed the issue down a bit more since I made my post
    the issue seems to be that the button nodes can see/recognize the mouse at all, hover over animations don't take effect which I can take to mean that the buttons can't "see" the mouse for one reason or another.
    I have tried running the base button scene and it has the same effect, no response.
    and to make sure that I'm not missing the pressed event I have added print("Pressed") to the function for when the button is pressed inside of the button script

    here is the way the button is structured for reference:

  • BlackAxolotlGamesBlackAxolotlGames Posts: 3Member
    Accepted Answer

    So I eventually found the issue, the issue I was having was I was autoloading a scene that had a canvas layer covering the whole screen and that was what was blocking the buttons from being clicked. after removing the canvas layer and restructuring that scene, all of my buttons were clickable

  • TwistedTwiglegTwistedTwigleg Posts: 2,561Admin

    Awesome! I'm glad you were able to figure it out :smile:

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.