godot: ERROR: Parent node is busy setting up children, `add_child()` failed. Consider using `add_child.call_deferred(child)` instead.
Hello! I’m making a game at Godot that plays with first-person Parkour mechanics and somehow, shortly after I messed with the resolution settings of my project, this bug started showing up in my project both in the console and in Debugger. The biggest problem with this bug is that it doesn’t allow me to open my Project Settings. Every time I try, the engine crashes. I first reported it on the Godot Facebook group, but nobody found the problem. Some users pointed out the possibility of some plugin causing this problem, but the only plugin I’m using is a Kanban plugin that I’ve had since the beginning of the project it didn’t give problems before and the problem doesn’t go away after I delete it. I haven’t found other people with the same problem, only this case (https://github.com/godotengine/godot/issues/73765) in which the same bug happens in a different way and by triggering an option that is not activated in my project. I am convinced that this is some structural bug in the engine because the more I spindle my project and all my scripts, the less I find reasons for it to happen, considering that it appears every time the game is started. Anyway, I’m sending here the code from my Main Scene, my project.godot and my global script, which are nothing big, just basic scripts to set the game menu (after all, the bug appears as soon as the engine starts, before any scene is started).
project.godot:
; Engine configuration file.
; It's best edited using the editor UI and not directly,
; since the parameters that go here are not all obvious.
;
; Format:
; [section] ; section goes between []
; param=value ; assign values to parameters
config_version=5
[application]
config/name="FPSTest"
run/main_scene="res://main_game_root.tscn"
config/features=PackedStringArray("4.0", "Forward Plus")
config/icon="res://icon.svg"
[autoload]
Global="*res://Global.gd"
[display]
window/size/resizable=false
window/stretch/mode="canvas_items"
[editor_plugins]
enabled=PackedStringArray("res://addons/kanban_tasks/plugin.cfg")
[input]
ui_accept={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":32,"physical_keycode":0,"key_label":0,"unicode":32,"echo":false,"script":null)
]
}
ui_select={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194325,"key_label":0,"unicode":0,"echo":false,"script":null)
]
}
ui_focus_next={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194326,"key_label":0,"unicode":0,"echo":false,"script":null)
]
}
ui_left={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194319,"physical_keycode":0,"key_label":0,"unicode":4194319,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":13,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"echo":false,"script":null)
]
}
ui_right={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194321,"physical_keycode":0,"key_label":0,"unicode":4194321,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"echo":false,"script":null)
]
}
ui_up={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194320,"physical_keycode":0,"key_label":0,"unicode":4194320,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":11,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"echo":false,"script":null)
]
}
ui_down={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194322,"physical_keycode":0,"key_label":0,"unicode":4194322,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"echo":false,"script":null)
]
}
Dash={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":67,"key_label":0,"unicode":99,"echo":false,"script":null)
]
}
Jump={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"echo":false,"script":null)
]
}
Pause={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194305,"key_label":0,"unicode":0,"echo":false,"script":null)
]
}
[physics]
common/physics_ticks_per_second=250
Main scene Script:
extends Control
@export var lastScene: String
@export var actualScene: String
@export var nextScene: String
var instanceScene
@export var loadingScene = load("res://HUD/load_screen.tscn")
var instancedLoadingScene = loadingScene.instantiate()
var gameVis
var configVis
var menuVis
var loadVis
func _ready():
pass
func _process(_delta):
_menuScreen()
_pauseScreen()
_configScreen()
gameVis = Global.gameVis
configVis = Global.configVis
menuVis = Global.menuVis
loadVis = Global.loadVis
nextScene = Global.nextSceneToLoad
if Global.loadIsReady == true:
if $SubViewportContainer/SubViewport/GameLayer.get_child_count() == 0:
instanceScene = load(nextScene).instantiate()
$SubViewportContainer/SubViewport/GameLayer.add_child(instanceScene)
Global.loadIsReady = false
Global.gameVis = true
Global.configVis = false
Global.menuVis = false
Global.loadVis = false
$SubViewportContainer/SubViewport/Background.visible = false
else:
Global.loadIsReady = false
if Global.isItLoading == true:
if $SubViewportContainer/SubViewport/LoadingLayer.get_child_count() == 0:
$SubViewportContainer/SubViewport/LoadingLayer.add_child(instancedLoadingScene)
Global.isItLoading = false
else:
Global.isItLoading = false
$SubViewportContainer/SubViewport/GameLayer.visible = gameVis
$SubViewportContainer/SubViewport/ConfigMenuLayer.visible = configVis
$SubViewportContainer/SubViewport/MenuLayer.visible = menuVis
$SubViewportContainer/SubViewport/LoadingLayer.visible = loadVis
func _menuScreen():
pass
func _pauseScreen():
pass
func _configScreen():
pass
func _loadingScreen():
pass
Global Script:
extends Node
var gameVis = false
var configVis = false
var menuVis = true
var loadVis = false
var nextSceneToLoad = "res://HUD/load_screen.tscn"
var loadIsReady = false
var isItLoading = false
var pauseState = false
Plus, The error after I play the game:
Parent node is busy setting up children, `add_child()` failed. Consider using `add_child.call_deferred(child)` instead.
scene/main/window.cpp:1459 - Condition "!is_inside_tree()" is true.
Parent node is busy setting up children, `add_child()` failed. Consider using `add_child.call_deferred(child)` instead.
Parent node is busy setting up children, `add_child()` failed. Consider using `add_child.call_deferred(child)` instead.
About this issue
- Original URL
- State: open
- Created a year ago
- Reactions: 1
- Comments: 26 (4 by maintainers)
I fixed the error after remembering that I had previously activated automatic saving when the window lost focus, in the editor settings. After deactivating this option, this error has no longer appeared. The physics are still broken but it only happens in this specific project which leads me to think that the physics thing is another cause and not this error that gave.
Still present in 4.2.1.
MRP attached, Just focus/unfocus the Godot window and it is logged.
Error only happens when “interface/editor/save_on_focus_loss” is enabled.
test.zip
A new update about this bug: IT IS HAPPENING EVEN IN NEW UNTOUCHED PROJECTS!!! I was so frustrated trying to delete specific things in the programming to correct this bug, but nothing was working. Then, I just started a new project empty and just created a node. Nothing more than that, and the bug happened! I don’t know if it is some problem with my system specifically but I really don’t know what I can do.