Variables in Autoload saved twice

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

Hello everyone.
I have a problem with all the variables I have in an autoload script. In fact, the variables are initialized like this:

var point

in the script of the autoload. Playing, these variables are changed from other scenes with normal assigns like this:

Globals.point=2 #Globals is the autoload’s name

When I try to print the value of the variable, in this case, I expect to see a 2. Instead when I try to print it in a _process function, it shows me something like that:

Null
2
Null
2
(…)

It seems to print me each time the initialization value of the variable and the new value.
If I try to add to the code something like this:

Globals.point=Globals.point+1

It prints me:

Null
3
Null
3
(…)

How can I solve that?

If you mark the code and press the curly brackets icon, the code will be shown as code, not as normal text. It’s better to read then.

MaaaxiKing | 2020-06-04 18:34

Is there maybe a scene you are playing in which any node has the Globals.gd script attached?

MaaaxiKing | 2020-06-04 18:37

That was the probem! Thank you for the hint. I had already look for that but I missed out a General node attached to another node.

Parrot | 2020-06-05 08:54

Flag is used to label comments as spam or inappropriate

MaaaxiKing | 2020-06-05 09:08