0 votes

Not sure if this has been asked, but in the gui you can connect a signal to a function in your code. Where is the fact that this connection has been made stored? It's not in the script itself (other than the function). There are other bits and bobs like values that you edit in the gui for variables with the export keyword. Where do these things which are not in the script itself get stored?

in Engine by (251 points)

1 Answer

0 votes
Best answer

These are stored in the .tscn file for the scene itself. The file is text-based and you can open it in a text editor to see the contents. For example, this is what my game's EventSystem.tscn looks like:

[gd_scene load_steps=2 format=2]

[ext_resource path="res://entity/EventSystem.gd" type="Script" id=1]

[node name="EventSystem" type="Node2D"]
script = ExtResource( 1 )

[node name="Timer" type="Timer" parent="."]
one_shot = true
[connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"]

Note the [connection] block; that's where the signal is defined.

by (46 points)
selected by
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 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 webmaster@godotengine.org with your username.