Hey!
I have made load func, where it finds files(TSCN) and then loads them when you press the button, but it loads them on scene every time i press load button,,, so how can i make it recognise that it already loaded them, so that it doesnt load them on every tie you press the button? Heres my code..
var dir = Directory.new()
var folder = ("res://SAVES_folder")
if dir.open(folder) == OK:
dir.list_dir_begin()
var FILES = dir.get_next()
while FILES != "":
if not dir.current_is_dir() :
var file_path = folder + "/" + FILES
print(file_path)
var path = load(file_path) #shortcut for the filepath combo
var obj = path.instance() #instance the shortcut to load
obj.get_name()
add_child(obj)
FILES = dir.get_next()
dir.remove(FILES)
I tried to make a counter, when there have been scenes loaded, it adds +1 and then if loaded scenes >1, do not load and such,, but didnt work..