繁体   English   中英

当我尝试构建我的项目时,Unity 给我错误

[英]Unity giving me errors when i try to build my project

我试图在 Unity 中构建我的项目。 但是,我有很多错误。 我是新手。 这是我的错误

谢谢你

Assets\BrightAnimator\Runtime\Editor\PlayAudioClipEditor.cs(9,30): error CS0115: 'PlayAudioClipEditor.OnInspectorGUI()': 找不到合适的方法来覆盖

Assets\BrightAnimator\Runtime\Editor\PlayAudioClipEditor.cs(7,40):错误 CS0246:找不到类型或命名空间名称“Editor”(是否缺少 using 指令或程序集引用?)

Assets\BrightAnimator\Runtime\Editor\PlayAudioClipEditor.cs(5,6):错误 CS0246:找不到类型或命名空间名称“CustomEditorAttribute”(是否缺少 using 指令或程序集引用?)

Assets\BrightAnimator\Runtime\Editor\PlayAudioClipEditor.cs(5,6):错误 CS0246:找不到类型或命名空间名称“CustomEditor”(是否缺少 using 指令或程序集引用?)

Assets\BrightAnimator\Runtime\Editor\PlayAudioClipEditor.cs(6,6):错误 CS0246:找不到类型或命名空间名称“CanEditMultipleObjectsAttribute”(是否缺少 using 指令或程序集引用?)

Assets\BrightAnimator\Runtime\Editor\PlayAudioClipEditor.cs(6,6):错误 CS0246:找不到类型或命名空间名称“CanEditMultipleObjects”(是否缺少 using 指令或程序集引用?)

构建 Player 时出错,因为脚本有编译器错误

构建在 7 秒(6799 毫秒)内完成,结果为“失败” UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

UnityEditor.BuildPlayerWindow+BuildMethodException: 7 errors at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002ca] in <5ad584e208e14caaa9e6b2e6027e9204>:0 at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080 ] 在 <5ad584e208e14caaa9e6b2e6027e9204>:0 UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

您正在使用导致这些错误的UnityEditor代码。 要解决此问题,您必须分别在每个编辑器脚本的顶部和底部添加#if UNITY_EDTIOR#endif

例子

#if UNITY_EDITOR
using UnityEngine;
using UnityEditor;

public class MyClass: Editor
{
    // Your code
}
#endif

#if UNITY_EDITOR解决方案的替代方法是将程序集定义文件放入(每个) Editor文件夹中,并仅在其中启用编辑器平台。

暂无
暂无

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

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