簡體   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