添加Scripts失败,弹窗报错无法添加脚本/组件(Can’t add script component, becausethe script dass cannot be found. Make sure that there are no compile errors and that the file name and classname match.)
解决步骤:
1.检查Scripts文件名和类名是否一致,发现一致添加,继续报错。
2.Inspector属性面板 Add Component 发现查不到其他组件的脚本和要添加的脚本。
3.直接Add Component里面添加新建一个Scripts 发现新建在Assets根目录
4.Add Component新建一个同名的脚本 放进Scripts文件夹 发现检测了同名,提问是否覆盖。
5.点击其他组件发现脚本下显示 The associated script can not be loaded.Please fix any compile errors... 删除该脚本并添加 发现找不到该脚本。
6.关闭Unity并打开。发现一个组件的脚本效果并未执行。因为有Color 该脚本自动添加了System.Drawing.删除引用,启动Unity的Color。效果执行。关闭Unity
7.Add Component Unity可以找到Scripts了