This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

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 =
var folder = ("res://SAVES_folder")

if == OK:
    var FILES = dir.get_next() 
    while FILES != "":
        if not dir.current_is_dir() :
            var file_path = folder + "/" + FILES 
            var path = load(file_path) #shortcut for the filepath combo
            var obj = path.instance() #instance the shortcut to load
        FILES = dir.get_next()

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..

in Engine by (227 points)

1 Answer

0 votes

I am not sure but this seems to be logical problem(unless I am mistaken). You can try following (untested python derived )simple code instead of add_child(obj):

var filesAdded      #Array to store filepath of added files
if current not in fileadded:

Take a look at my file copy finder written in python for reference.
Also I guess you to take a look at Python book like this if you haven't yet.

by (51 points)
edited by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.