Skip to content

Commit

Permalink
Fix autoload node cannot be accessed by plugin on start-up
Browse files Browse the repository at this point in the history
  • Loading branch information
Hilderin committed Jul 26, 2024
1 parent 607b230 commit 2d4e573
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion editor/editor_autoload_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,9 @@ void EditorAutoloadSettings::init_autoloads() {

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

0 comments on commit 2d4e573

Please sign in to comment.