Variable accessed by another scripts

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Pedro Karut Gimenez
:warning: Old Version Published before Godot 3 was released.

Hi Guys! I have a variable called “quantity” in my main script and I want to modify its value using other scripts that are in another scenes. How Can I do it?

Hi,
you have the answer there: https://forum.godotengine.org/1883/transfering-a-variable-over-to-another-scene.

ludosar | 2016-07-26 19:25

As ludosar + Globals.set(name, var)

splite | 2016-07-27 07:37

:bust_in_silhouette: Reply From: linux.linux

First i think you know how set global.gd autoload script for work with Global Variables right?

Here is my example
Put in your global.gd script:

extends Node

var example

Now you will have acess with global.example sintaxe in any scene in any node from your project :wink: