我尝试为HoloLens构建Unity项目并收到以下错误:
UnityEditor.PackageManager.Requests.SearchRequest操作失败,错误:UnityEditor.PackageManager.Error UnityEditor.EditorApplication:Internal_CallUpdateFunctions()
有人有个主意吗?
使用UnityEditor
命名空间的任何内容都只能在Unity内部使用。 UnityEditor
命名空间在构建中被完全剥离。
确保您不依赖于运行时脚本中的任何UnityEditor
类。
要避免使用该命名空间的文件的构建错误,有两个选项:
Editor
的文件夹中。放置在这样一个文件夹中的任何内容也不会被编译到最终版本中,但只能在Unity内部使用。#if UNITY_EDITOR
using UnityEditor;
using UnityEditor.Internal;
// Etc
#endif
而且还
#if UNITY_EDITOR
// Some code using UnityEditor stuff here
#endif
你的脚本中的任何地方都应该使用UnityEditor
命名空间,只能在Unity内部使用,但在构建中被剥离。