gpt4 book ai didi

unity3d - Unity 缺少命名空间

转载 作者:行者123 更新时间:2023-12-02 11:09:53 24 4
gpt4 key购买 nike

几个小时前,我试图编译我的游戏,但没有成功。在控制台中出现了这个错误:
enter image description here
enter image description here
我不知道这意味着什么或编译器有什么问题。每次构建总是在 7 秒后失败。我已经尝试编译了 2 次,但没有成功。只有这个项目给我带来了一些麻烦,我不知道我是否应该改变它的编译方式,或者我的代码是否有一部分是错误的。非常感谢您的帮助!

最佳答案

现在您添加了实际错误:
你得到的是缺少 UnityEditorInternal 的命名空间

The type or namespace name 'UnityEditorInternal' could not be found (are you missing a using directive or an assembly reference?)


您的脚本会发生这种情况 CameraFollow.cs , PlayerSword.cs , HealthRenderer.cs , LevelData.cs , MovingZomby.cs , Player.cs , ...没有看到这些就不可能给出具体的详细答案。
但我能说的是:整个 UnityEditorUnityEditorInternal命名空间在构建中被完全剥离,因为它们只存在于 UnityEditor 本身中!
您不能在构建/最终应用程序中使用它的任何内容!
如果您的运行时代码依赖于它……恐怕您必须寻找另一个解决方案;)
然而,这些通常只用于 Custom Editor脚本。
确保相应的代码块仅位于名为 Editor 的文件夹中的文件中。 (这些也会在构建过程中被删除)或使用 Platform dependent compilation并包装 using 语句以及使用 #if pre-processors 中的命名空间的任何内容
#if UNITY_EDITOR
using UnityEditorInternal;
#endif

...

#if UNITY_EDITOR
// anything using that namspace
#endif

关于unity3d - Unity 缺少命名空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63057312/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com