[英]Unity giving me errors when i try to build my project
i have tried to build my project in Unity.我试图在 Unity 中构建我的项目。 but, i got a lot off error.但是,我有很多错误。 iam a newbie.我是新手。 here's my error's这是我的错误
Thank You谢谢你
Assets\BrightAnimator\Runtime\Editor\PlayAudioClipEditor.cs(9,30): error CS0115: 'PlayAudioClipEditor.OnInspectorGUI()': no suitable method found to override Assets\BrightAnimator\Runtime\Editor\PlayAudioClipEditor.cs(9,30): error CS0115: 'PlayAudioClipEditor.OnInspectorGUI()': 找不到合适的方法来覆盖
Assets\BrightAnimator\Runtime\Editor\PlayAudioClipEditor.cs(7,40): error CS0246: The type or namespace name 'Editor' could not be found (are you missing a using directive or an assembly reference?) Assets\BrightAnimator\Runtime\Editor\PlayAudioClipEditor.cs(7,40):错误 CS0246:找不到类型或命名空间名称“Editor”(是否缺少 using 指令或程序集引用?)
Assets\BrightAnimator\Runtime\Editor\PlayAudioClipEditor.cs(5,6): error CS0246: The type or namespace name 'CustomEditorAttribute' could not be found (are you missing a using directive or an assembly reference?) Assets\BrightAnimator\Runtime\Editor\PlayAudioClipEditor.cs(5,6):错误 CS0246:找不到类型或命名空间名称“CustomEditorAttribute”(是否缺少 using 指令或程序集引用?)
Assets\BrightAnimator\Runtime\Editor\PlayAudioClipEditor.cs(5,6): error CS0246: The type or namespace name 'CustomEditor' could not be found (are you missing a using directive or an assembly reference?) Assets\BrightAnimator\Runtime\Editor\PlayAudioClipEditor.cs(5,6):错误 CS0246:找不到类型或命名空间名称“CustomEditor”(是否缺少 using 指令或程序集引用?)
Assets\BrightAnimator\Runtime\Editor\PlayAudioClipEditor.cs(6,6): error CS0246: The type or namespace name 'CanEditMultipleObjectsAttribute' could not be found (are you missing a using directive or an assembly reference?) Assets\BrightAnimator\Runtime\Editor\PlayAudioClipEditor.cs(6,6):错误 CS0246:找不到类型或命名空间名称“CanEditMultipleObjectsAttribute”(是否缺少 using 指令或程序集引用?)
Assets\BrightAnimator\Runtime\Editor\PlayAudioClipEditor.cs(6,6): error CS0246: The type or namespace name 'CanEditMultipleObjects' could not be found (are you missing a using directive or an assembly reference?) Assets\BrightAnimator\Runtime\Editor\PlayAudioClipEditor.cs(6,6):错误 CS0246:找不到类型或命名空间名称“CanEditMultipleObjects”(是否缺少 using 指令或程序集引用?)
Error building Player because scripts had compiler errors构建 Player 时出错,因为脚本有编译器错误
Build completed with a result of 'Failed' in 7 seconds (6799 ms) UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)构建在 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] in <5ad584e208e14caaa9e6b2e6027e9204>:0 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&)
You are using UnityEditor
code which is causing these errors.您正在使用导致这些错误的UnityEditor
代码。 To fix this, you have to add #if UNITY_EDTIOR
and #endif
on top and bottom of each editor script respectively.要解决此问题,您必须分别在每个编辑器脚本的顶部和底部添加#if UNITY_EDTIOR
和#endif
。
#if UNITY_EDITOR
using UnityEngine;
using UnityEditor;
public class MyClass: Editor
{
// Your code
}
#endif
An alternative to the #if UNITY_EDITOR
solution is to place an assembly definition file into (each of) your Editor
folders, and enable ONLY the Editor platform in it. #if UNITY_EDITOR
解决方案的替代方法是将程序集定义文件放入(每个) Editor
文件夹中,并仅在其中启用编辑器平台。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.