Godot Version
4.3
Question
Hey everyone,
I’m working on a high score entry system in Godot, where a LineEdit node should trigger the _on_text_submitted function when the user submits text. However, the signal doesn’t seem to be working.
Here’s the relevant code snippet:
var entry = highscore_entry.instantiate()
entry.show()
# If the name field is empty, allow user input
if item["name"] == "":
entry.get_node("name").hide()
entry.get_node("LineEdit").show()
# Connect the signal
entry.get_node("LineEdit").text_submitted.connect(_on_text_submitted)
print(entry.get_node("LineEdit").is_connected("text_submitted", _on_text_submitted)) # Debugging
user_score_item_pos = i
$Confetti.emitting = true
new_highscore = true
# Focus must be set in the next frame
call_deferred("_grab_focus", entry.get_node("LineEdit"))
else:
entry.get_node("name").text = item["name"]
entry.get_node("score").text = str("[right]" + str(item["score"]) + "[/right]")
$Scores/Container.add_child(entry)
What’s the problem?
- The text_submitted signal is connected to _on_text_submitted, but it never triggers.
- The print() statement confirms that the signal is successfully connected.
- The LineEdit is visible and focused, so the user should be able to input text.
Has anyone encountered this issue before? Could it be related to how I’m instantiating and adding the node? Any help would be greatly appreciated!
Thanks in advance!
Hiere is the node-tree of the node tree when the game is running