[Noob] Pressed texture button signal don't work

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By marco_vito

Hi there,
Fisrt of all, sorry to bother with what I think is a trivial problem. I’ve decided, a couple of weeks ago, to try to pursue my dream to develop videogames. as someone who never studied advanced maths or programming, everything is really knew (and sometimes overwhelming). I’ve started learning C# and trying to figure out Unity; after 10 days of a lot of pain, I discovered Godot and would really like to stick with an open-source engine. So, my qyestion might seem dumb, but I only spent a couple of hours in the last two days with Godot, and couldn’t find anything similar after a lot of search time in Google and in the forums.


I’ve decided to start a little arcade-like project, to try a couple different things. The first step to me was setting the UGI. So, I’ve created fours scenes (Intro, Credits, HighScore and Game), and created a script in each scenes (except Game) to tell Texture Buttons to load another scene.

As an exemple, I’ll put the code for the Intro scene right bellow:

    extends Control

func _on_StartButton_pressed():

func _on_QuitButton_pressed():

func _on_HighscoreButton_pressed():

func _on_Credits_pressed():

I “wrote” this code using the signals in the buttons. And I’ve choosed the “pressed()” signal. But When I try to play the game, clicking on the buttons don’t do anything.

enter image description here

So, I’m kind of lost because I do not know what I did wrong. I’ve read all the documentation of signals, watched a couple of tutorials about the subject, but can’t figure out why it doesn’t work.

Thank you all!

:bust_in_silhouette: Reply From: volzhs

You have a RichTextLabel under each button.
I guess the RichTextLabel grabs the mouse click event.
so, you need to change Mouse > Filter to Ignore or Pass of the RichTextLabel node.

Ok, that makes sense… Thank you!

Just to be clear, when I try to click, I end up clicking in the “RichTextLabel” instead of clicking in the button itself. Is that right?

Can you (or someone) explain me whats the diference between “Ignore” and “Pass” in the mouse filter?

marco_vito | 2019-03-01 13:15

It’s late, but i can explain. (Sry for bad english.)

So, if you set the mouse filter of the RichTextLabel to Pass, then the RichTextLabel will has mouse events(pressed, mouse_entered, …) AND the button behinds it has mouse events too.

If you set the mouse filter of the RichTextLabel to Ignore, then the RichTextLabel will NOT has mouse events but the button has mouse events.

If you set the mouse filter of the RichTextLabel to Stop, then ONLY the RichTextLabel will has mouse events and the Button behind it doesn’t.

DinnyeSensei | 2020-05-03 14:22