Godot Version 4.2
How do I save a character name input from a LineEdit node with a Button node as a variable and place that variable in my Globals script?
Hello! This question has a few parts, so I’ll break them down.
I have a naming scene that gets loaded into my main scene when the player presses the “new character” button. The naming scene has a line edit node where the player can type their character’s name, and a button below that to confirm the name. I don’t want the line edit to emit a signal for when enter is pressed, because I want this to be a mobile game, hence the confirm button. So right now I have this script for when the line edit is simply changed emitting to the name scene:
func _on_name_type_text_changed(new_text):
charname = new_text
print(new_text)
which works fine.
But what I can’t figure out is how to then save the charname variable when the confirm button is pressed, since that’s a whole different signal also in the naming scene, and then from there how to get the charname variable into my globals script so it can be saved and referenced for the rest of the game.
Any thoughts would be really appreciated!