Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | bob333 |
Hi,
I have created “Node2d” object and “RichTextLabel” as its child. The Node2d.gd script contains the following code to print the “$RichTextLabel” on mouse click. For every single mouse press (not release only pressed) this method is called twice and and first time the “not null” and then in the second call its prints “null”. There are 2 bugs. I expect to call once on mouse press and it should not be null. What is wrong in the following code ?
func _input(event):
if event is InputEventMouseButton:
if $RichTextLabel:
$RichTextLabel.add_text("hello")
print("not null")
else:
print("null")