【问题标题】:Unity 5.3.3 UI does not exist in namespace命名空间中不存在 Unity 5.3.3 UI
【发布时间】:2016-06-18 13:52:39
【问题描述】:

所以我从事 Unity 项目已经有一段时间了,从几周前开始,每次我尝试将 Visual Studio 附加到 Unity 时,都会遇到多个错误。我得到的所有错误都与“UnityEngine.UI”有关

CS0234  The type or namespace name 'UI' does not exist in the namespace 'UnityEngine' (are you missing an assembly reference?)

我根本没有编辑解决方案文件,我也没有更改任何引用。

现在奇怪的是,当我构建时会得到一个错误列表,但是如果我双击一个,它会将我带到错误位置,然后所有错误都会消失,就像解决方案很好一样。但是,如果我随后构建项目,我会得到所有错误...

我认为您可以重现此错误的唯一方法是创建一个新的 Unity 项目(我使用的是 5.3.3f1),创建一个脚本并包含此命名空间

using UnityEngine.UI;

然后看看你是否可以构建项目。如果有人知道这个项目的解决方案会很棒:)

在我的“警告”窗口中我也有这 3 个

The primary reference "UnityEditor" could not be resolved because it has an indirect dependency on the framework assembly "System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v3.5,Profile=Unity Web v3.5".

The primary reference "UnityEngine.Networking" could not be resolved because it has an indirect dependency on the framework assembly "System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v3.5,Profile=Unity Web v3.5".

The primary reference "UnityEngine.UI" could not be resolved because it has an indirect dependency on the framework assembly "System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v3.5,Profile=Unity Web v3.5".

【问题讨论】:

  • 这只会导致无法找到更多内容的崩溃。

标签: c# unity3d reference namespaces


【解决方案1】:

当您的最后一个构建目标是“Web Player”时会发生这种情况。

  1. 打开:文件->构建设置...
  2. 选择 PC、Mac 和 Linux 独立版
  3. 构建您的游戏 - 在此步骤中,将修复 VS 解决方案设置

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-10-02
    • 2020-09-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-19
    相关资源
    最近更新 更多