简体   繁体   English

Unity 2019.2.* - 尝试构建后出现不可见/空错误

[英]Unity 2019.2.* - Invisible/empty errors after trying to build

In short, for some reason I can not figure out, two empty errors appear in my log .简而言之,由于某种原因我无法弄清楚,我的日志中出现两个空错误 These persist after clearing, on restart and occur in every project , both existing and new.这些在清除后仍然存在,重新启动并出现在每个现有和新项目中 Un- and re-installing Unity seem to have no effect whatsoever.卸载和重新安装 Unity 似乎没有任何效果。

Unity 编辑器显示带有空错误问题的新空项目。

This issue started appearing for me in Unity 2019.2.1 and persists even after updating to the most recent 2019.2.14f1 .这个问题在 Unity 2019.2.1 中开始出现,即使在更新到最新的2019.2.14f1后仍然存在。 Because they are errors, they prevent me from running or building the project which means I am completely stuck and can not use Unity until I find a way to fix this.因为它们是错误,所以它们阻止我运行或构建项目,这意味着我完全卡住了并且在找到解决此问题的方法之前无法使用 Unity。 I am using Windows 10.我正在使用 Windows 10。

I have already submitted this issue to Unity, but I think it is an issue with my installation, so I don't know if they'll be able to help me.我已经向Unity提交了这个问题,但我认为这是我的安装问题,所以我不知道他们是否能够帮助我。

The issue appeared in one project and seemed to be contained to that one project until I attempted to build another project.该问题出现在一个项目中,并且似乎包含在该项目中,直到我尝试构建另一个项目。 The moment I try to build a project, the issue appears and will persist no matter what I do.在我尝试构建项目的那一刻,无论我做什么,问题都会出现并且会持续存在。 Even if a project is completely empty and brand new, the moment I attempt to build the project, the errors appear and the project becomes "cursed" with them.即使一个项目是完全空的和全新的,在我尝试构建项目的那一刻,错误就会出现并且项目被它们“诅咒”。

Something that might be the cause, but might also be a symptom, is that scripts will indicate that they can not find UnityEngine.一些可能是原因但也可能是症状的东西是脚本将指示他们找不到 UnityEngine。 Is there any way to manually install those libraries?有没有办法手动安装这些库?

Even after manually uninstalling Unity, Visual Studio and removing all references to Unity from AppData, then installing the most recent versions of Unity and Visual Studio, the issue persists.即使手动卸载 Unity、Visual Studio 并从 AppData 中删除对 Unity 的所有引用,然后安装最新版本的 Unity 和 Visual Studio,问题仍然存在。

I have not been able to test an affected project on a different computer, but I will update this question if I do.我无法在另一台计算机上测试受影响的项目,但如果我这样做,我会更新这个问题。 If Unity does get back to me with a solution I'll post that.如果 Unity 确实通过解决方案回复我,我会发布该解决方案。


Edit:编辑:

The true cause of the issue was that for whatever reason, Unity could not find Roslyn.问题的真正原因是,无论出于何种原因,Unity 都找不到 Roslyn。 Hence why scripts were unable to compile, which resulted in the Unity Editor itself being affected.这就是为什么脚本无法编译,从而导致 Unity Editor 本身受到影响的原因。

I've added the solution to this issue as an answer to this question.我已经添加了这个问题的解决方案作为这个问题的答案。

This issue has been solved with a response from the Unity team!此问题已通过 Unity 团队的回复解决!

This is their solution:这是他们的解决方案:

Please try the following steps to fix the issue:

 1. Close any open Unity Editors
 2. Go to "C:\Program Files\Unity\Hub\Editor\(Your Unity version)\Editor\Data\Tools\RoslynScripts"
 3. Edit "unity_csc.bat" (You might have to run Notepad as an administrator to be able to save it)
 4. Replace the line that says "%APPLICATION_CONTENTS%\Tools\Roslyn\csc" /shared % with the following: "C:\Program Files\Unity\Hub\Editor\(Your Unity version)\Editor\Data\Tools\Roslyn\csc.exe" /shared %

Leaving it here for any future Google searches.将其留在这里以供将来进行任何 Google 搜索。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM