在首次使用VS在Unity编写脚本时,Unity界面报错
errorCS0138: A'using namespace' directive can only beapplied to namespaces; 'Event' is a type not a namespace. Consider a 'using static' directive instead
error CS0246:The type or namespace name 'UnityEventc ' could not be found (are you missing a using directive or an assembly reference?)
errorCSO246:The type or namespace name "Vertor3' could not be found (are you missing a using directive or an assembly reference?)
如果尝试网上各种这三种错误解决方案后,将unity,vs反复重装,跟换各种版本依旧无效。而同时,这三个报错不是出现在VS中。可能只是一个简单的问题。
首先打开Unity中的脚本,看到解决方案资源管理器这一板块。如果出现了
这些资源后有某某不兼容的情况。
那么,直接打开VS安装组件界面,下拉到桌面应用和移动应用,把.NET桌面开发
这一类可选进行安装。
回到Unity打开脚本,重新加载解决方案资源管理器。保存代码,回到Unity解决问题。