Autoload out of sequence

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By todog


New to Godot.
Trying the autoload tutorial: Singletons (AutoLoad) — Godot Engine (3.0) documentation in English

I’m getting error: Parser Error: Identifier not found: current_scene

The global variable current_scene isn’t defined when referenced in contains the definition of the variable and is supposed to be loaded first through autoload but it isn’t.

I put the debugger on it and find that _ready in Global.pd is called after _ready in

This is contrary to doco.

No clue.

In Godot 3.0.6 i’m getting this:
autoload’s _enter_tree()
main scene’s _enter_tree()
autoload’s _ready()
main scene’s _ready()
So it’s different from what your debugger says. What’s your Godot’s version?

Perhaps order of calling _ready() is undefined.

hilfazer | 2018-12-29 10:35

:bust_in_silhouette: Reply From: kidscancode

In this tutorial, there should be no reference to current_scene in either scene_a or scene_b. They only contain the button signal callback.

You may find it easier to look at the updated version, which has been rewritten to be a bit clearer. When contributors make changes to the docs, they are applied to the latest version, and then backported where appropriate.

Latest version: Singletons (Autoload) — Godot Engine (latest) documentation in English

Ah that’s better; thanks. However looks like a bug in the supplied zip:

cat Scene2.tscn
[[ext_resource path=“res://” type=“Script” id=1]

resource_path should point to

Not sure if this is worth raising an issue for.

todog | 2018-12-29 01:20

No, that’s correct. The script resource attached to Scene2.tscn is “”.

kidscancode | 2018-12-29 01:25

right. What thought was the fix got it working but that wasn’t the logical fault.

Actual fault is the Scene2/1 gd files point to themselves in goto_scene.

todog | 2018-12-29 01:35

Ah - I see the typo, yes. I’ll update the doc.

kidscancode | 2018-12-29 01:40