0 votes

I'm trying to load resources dynamically. It works normally on the computer, but on android the following error occurs:

Invalid type in built-in function 'dict2inst'. Cannot convert argument 1 from Nil to Dictionary.

I'm trying to load some Curve2D exported earlier. Here is the code:

extends Node

var paths = []

const path_dir = "res://paths/"

func _ready():
    load_paths()
    pass

func random_path():
    return paths[randi() % paths.size()]

func load_paths():
    var dir = Directory.new()
    dir.change_dir(path_dir)
    dir.list_dir_begin()

    var path_file = dir.get_next()
    var path
    while path_file != "":
        if dir.current_is_dir():
            pass
        else:
            print("loading: " + path_dir + path_file)
            path = load(path_dir + path_file)
            if path && path is Curve2D: #error occours here
                paths.append(path)

        path_file = dir.get_next()
in Engine by (171 points)

Please log in or register to answer this question.

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 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 webmaster@godotengine.org with your username.