0 votes

(Sorry for my English, I use Google translator)
I had a problem that the text from Lineedit is not transferred to the global script

extends Node2D

func _ready():
    Global.Player_Name = $LineEdit

func _on_Button_pressed():

Global script:

extends Node

var Player_Name = ''
in Engine by (61 points)

Edit: posted as answer.

4 Answers

+1 vote
Best answer

You only get the node not the text.


Global.Player_Name = $LineEdit

should look like this:

Global.Player_Name = $LineEdit.text
by (1,450 points)
selected by
+1 vote
by (232 points)
+1 vote

The "from another scene" search also yields a lot of results, this has been answered many times, in many ways and many situations https://godotengine.org/qa/search?q=From+another+scene

by (28,876 points)
0 votes

I just wanna say, while we're posting answers here:

If you ever need to persist an entire node between scenes, you can re-parent to the root viewport.

var child = get_child(0)

by (66 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.