Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | dogman | |
Old Version | Published before Godot 3 was released. |
Hello,
I have a singleton that has a global array variable.
Whenever I try to append an element into the array from an another script, it has no effect, nothing is added.
My singleton is called global, and I am trying to access my variable and append like this: global.arrayvariable.append(“stuff”)
No errors, it just stays an empty array.
Any idea what’s wrong here?
Can you post the code of your singleton? Did you used auto-load? Nothing is clearing the array?
Zylann | 2017-02-16 02:34
My singleton has 2 lines:
extends Node
var selected_units = Array();
I used auto-load yes, and it’s not being cleared since nothing is accessing the array other than the appending one in my other script.
dogman | 2017-02-16 09:59