我正在尝试动态加载资源。它在计算机上正常工作,但在android上出现以下错误:
内置函数“dict2inst”中的类型无效。无法将参数 1 从 Nil 转换为 Dictionary。
我正在尝试加载一些之前导出的 Curve2D。这是代码:
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()