Skip to content

Commit 2d4e573

Browse files
committed
Fix autoload node cannot be accessed by plugin on start-up
1 parent 607b230 commit 2d4e573

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

editor/editor_autoload_settings.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,9 @@ void EditorAutoloadSettings::init_autoloads() {
457457

458458
for (const AutoloadInfo &info : autoload_cache) {
459459
if (info.node && info.in_editor) {
460-
callable_mp((Node *)get_tree()->get_root(), &Node::add_child).call_deferred(info.node, false, Node::INTERNAL_MODE_DISABLED);
460+
// It's important to add the node without deferring because code in plugins or tool scripts
461+
// could use the autoload node when they are enabled.
462+
get_tree()->get_root()->add_child(info.node);
461463
}
462464
}
463465
}

0 commit comments

Comments
 (0)