I made a simple system that should show the variable “money” in a Node of type “Label” that I named “coin_counter”. The problem is that every time I change the text property and change the scene using some native godot method, for example: “change_scene_to_packed()” The engine ends up freezing/crashing. This only happens when the scene is changed, if I start the scene with the label right away, it works normally. It’s only when I change scenes that the crash happens. Even making simple changes:
"func _ready() → void:
coin_counter.text = “Hello World”, cause crash too. Please help me
If the scene is launched separately, then the problem is in the specific switching function.
A possible reason is that:
The change_scene_to_packed() function delete the scene with all the data, shortcut values, variable values, etc. But the new scene that replaces the old one does not have this data, the data is not transferred automatically.
Usually the change_scene_to_packed() function is used after manually loading a previously loaded but not deployed scene and is used with ResourceLoader.load_threaded_request. Therefore, in this particular case, it is better to try change_scene_to_file(). SceneTree — Godot Docs
Interesting. i had constant crashes like this but only when i switched to Godot 4.4. i’ve never had it under any other 4.x version. i had to unmigrate back to 4.3rc3 and it all magically worked again. i don’t know if that’s your problem but if you tried in a version prior to 4.3 stable maybe you’d get a different result?