Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var folder_path: String # something like "res://data/resources/items/"
- var item_database: Array
- func _load_all_items():
- var dir = DirAccess.open(_path)
- if dir:
- dir.list_dir_begin()
- var file_name = dir.get_next()
- while file_name != "":
- if dir.current_is_dir():
- print("Found directory: " + file_name)
- else:
- if file_name.ends_with(".remap"): #---For build
- file_name = file_name.replace(".remap", "") #---For build
- print("Found file: " + file_name)
- var item = load(folder_path + file_name)
- item_database.append(item)
- file_name = dir.get_next()
- else:
- print("An error occurred when trying to access the path.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement