Global - Scene Not Declared Error

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

I followed the tutorial on this page exactly.
Copy/pasted the code too.
Godot AutoLoad Tutorial

It said to add these two lines to each scene as per their template…

func _on_Button_pressed():
	Global.goto_scene("res://Scene1.tscn")

func _on_Button_pressed():
	Global.goto_scene("res://Scene2.tscn")

However, it generates these errors.

Global not declare in scope
Condition debug parse err line >= 0 is true. returned: __null
Can’t use get_node() with absolute paths from outside the active scene tree.

so, that means that the tutorial is wrong.

Also… why can’t I upload images?

You can only link images. So you’ll need to find a image hoster somewhere. I use #bot_cmd on the Godot Discord Server to host the images I post here lol.

Dlean Jeans | 2019-06-10 23:56

:bust_in_silhouette: Reply From: Dlean Jeans

EDIT: Autoload is case-sentitive.


I think you missed the whole thing - the most important step in the tutorial:

The next step is to add this script to the autoLoad list. Open Project > Project Settings from the menu, switch to the “AutoLoad” tab and select the script by clicking the .. button or typing its path: res://Global.gd. Press “Add” to add it to the autoload list:

No , You just assumed that. Which is wrong
I did that too… I would show a screenshot, but this forum doesn’t let me.

pixelinkmedia | 2019-06-10 17:26

Anyone else have any idea what is happening to this demo tutorial??

pixelinkmedia | 2019-06-10 21:25

Did you click the Add button? I did missed that step countless times when I was starting out.

Dlean Jeans | 2019-06-10 23:57

Again no… the global.gd is in the autolaod.
I did all that

No one believes me.

Here is a screenshot I had to upload to my own server,

Screenshot of GlobalGD LOADED.

pixelinkmedia | 2019-06-11 08:34

It’s case sensitive. Rename global to Global. Or just write
global.goto_scene("res://Scene1.tscn")

Dlean Jeans | 2019-06-11 09:32

For image hosting, you can use Imgur and link it here.

Dlean Jeans | 2019-06-11 09:34

That worked.

Someone needs to fix the tutorial because it is capitalized in it.

Newbies like me are not always going to think of case sensitive, especially when the error says nothing about case sensitive…

Newbies assume, that if Godot puts out a tutorial, it must be right.

Thanks for helping!

pixelinkmedia | 2019-06-11 09:42

Singletons is conventionally written in PascalCase so the first letter is capitalized.

Dlean Jeans | 2019-06-11 10:22