Unity 报错 Can’t add script component
添加Unity Component 失败,弹窗报错无法添加脚本/组件(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.)
但是编辑器和IDE都没有报错信息
自查其它原因都排除了(如未继承Monobehavior ,类名与文件名不匹配等),最后发现是使用宏开关时语法错误(syntax error when using macros.) 错误为 #if !!UNITY_EDITOR , 只能为 #if !UNITY_EDITOR 或者 #if UNITY_EDITOR