Passing variables between 2 Sibling Nodes/Scripts (NO AUTOLOAD)

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

While passing variables between 2 Sibling Nodes/Scripts ,the values passed are “NULL”.ie the values are not getting passed.
As this is a non-persistent situation, I do not wish to use Autoload.

Sample Call - Node1/Script1/Var1 to Node2/Script2/Var2

  var Var2 = get_Node(../Node1).Var1

The value passed above to Var2 is “NULL” ,
I have tried using _init() to instance the variables before assignment but still the values don’t get passed.
How can one pass variables between 2 sibling nodes in a non persistent situation?

Usually, I would use the parent node to indirectly communicate with the sibling node. tell the parent what to do, have the parent pass that data along to the sibling, then et them process it.

In a perfect world, child nodes would simply implement behavior and all the interaction would be through the parent node.

Kyle Guarco | 2019-09-16 21:12

:bust_in_silhouette: Reply From: Mikko

Introduce your variable like this: export var Var1
Now you can reference it your way.