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()
The problem is because of version 3.1. Isn't a stable version. In godot 3.0.6 works fine...