godot 报错 Cannot instance script because the associated class could not be found.

分类栏目:Godot教程

66

今天使用godot时出现下面错误

can_instantiate: Cannot instance script because the associated class could not be found. Script: 'res://scenes/main.tscn::CSharpScript_3yysn'. Make sure the script exists and contains a class definition with a name that matches the filename of the script exactly 

使用的时c#语言

看网上说是因为文件的名称不对,需要采用 Main  首字母大写,但我 确实是这样写的

后面自己查了下 发现是 场景加载的脚本有问题,不知道是什么bug,加载的 脚本名称不是我之前自动生成的,重新加载就可以了 ,很奇怪的问题