簡體   English   中英

當我嘗試構建我的項目時,Unity 出現奇怪的錯誤

[英]Unity gives strange errors when i try to build my project

當我嘗試構建我的項目時,出於某種原因,Unity 給了我這些奇怪的錯誤。 我不知道為什么它給了我這些錯誤,而它們應該早點給出。 我嘗試重新啟動統一,刪除“插件”文件夾,刪除 .sln 文件並將構建文件夾放在不同的文件夾中。 我該如何修復這些奇怪的錯誤?

這是代碼統一不斷給我錯誤,如果這有幫助的話: https : //paste.myst.rs/lwj5nsm1

這是 unity 給我的錯誤:

Assets\\LevelGenerator\\Scripts\\Editor\\LevelEditor.cs(9,30): 錯誤 CS0115: 'GeneratorEditor.OnInspectorGUI()': 找不到合適的方法來覆蓋

Assets\\LevelGenerator\\Scripts\\Editor\\LevelEditor.cs(7,48):錯誤 CS0234:命名空間“UnityEditor”中不存在類型或命名空間名稱“Editor”(您是否缺少程序集引用?)

Assets\\LevelGenerator\\Scripts\\Editor\\LevelEditor.cs(6,6):錯誤 CS0246:找不到類型或命名空間名稱“CustomEditorAttribute”(您是否缺少 using 指令或程序集引用?)

Assets\\LevelGenerator\\Scripts\\Editor\\LevelEditor.cs(6,6):錯誤 CS0246:找不到類型或命名空間名稱“CustomEditor”(您是否缺少 using 指令或程序集引用?)

UnityEditor.BuildPlayerWindow+BuildMethodException: UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002ca] in :0 at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions) 中的 5 個錯誤 [0x002ca] 0 UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

您的代碼用於編輯器,因此不應包含在構建結果中。為了解決這個問題,我創建了一個“DONOTCOMPILETHIS”構建指令,並將其添加到播放器設置中。 玩家設定 DLG

最后在你的代碼中添加:

using UnityEngine;

#if !DONOTCOMPILETHIS

using UnityEditor;

using UnityEditor.IMGUI.Controls;


[CustomEditor(typeof(CGameTower)), CanEditMultipleObjects]

public class CBoundRectEditor : Editor

{

    private BoxBoundsHandle m_BoundsHandle = new BoxBoundsHandle();


    ...

}

#endif

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM