Currently I want to import all my image files at runtime, which i've successfully managed to store in an array.
However, I cannot seem to access ANY variable found in a singleton. I just get an error.
For example, I have a singleton pics_array.gd, here is the code for it:
var pics = 
var a = 1
var path = "path/to/imagesFolder"
var dir = Directory.new()
var file_name = dir.get_next()
if file_name == "":
#break the while loop when get_next() returns ""
elif !file_name.begins_with(".") and !file_name.ends_with(".import"):
pics.append(load(path + "/" + file_name))
In my Picture_display node I have the following code:
When I run this scene I get the error:
"Invalid get index "a"(on base: 'Node2D (pics_array.gd)').
This is really confusing me as I am following at least what I think the documentation is telling me. Also the Enable next to the singleton is checked. I even added the Pictureimport scene (which has the picsarray node in it) but i'm still not getting any variable access.
I should add that i've already searched online but I havn't found the answer i'm looking for yet.