Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/file/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
File json文件没有';我不会出现在戈多_File_Godot - Fatal编程技术网

File json文件没有';我不会出现在戈多

File json文件没有';我不会出现在戈多,file,godot,File,Godot,我正在制作一个约会sim卡作为我的第一个游戏,我想用一个JSON文件来存储我所有的对话、精灵和B.G.m.有点像a.p.I;但是我编写的文件不会出现在godot文件系统部分 没有它我无法获得文件路径,有没有办法让它出现,或者我应该放弃 尝试使用文件API并将数据读入变量。像这样: var data ={} var path = "res://data.json" func _ready(): var jsonfile = File.new() jsonfile.open(pat

我正在制作一个约会sim卡作为我的第一个游戏,我想用一个JSON文件来存储我所有的对话、精灵和B.G.m.有点像a.p.I;但是我编写的文件不会出现在godot文件系统部分


没有它我无法获得文件路径,有没有办法让它出现,或者我应该放弃

尝试使用文件API并将数据读入变量。像这样:

var data ={}
var path = "res://data.json"
func _ready():
    var jsonfile = File.new()
    jsonfile.open(path, File.READ)
    data = parse_json(jsonfile.get_as_text())  
    print(data)
    pass

您还可以从Godot marketplace安装JSON编辑器资产-