Browse Source

fix初次编译时的一个报错

大爷 2 years ago
parent
commit
6918d65b97
1 changed files with 15 additions and 6 deletions
  1. 15 6
      Unity/Assets/Scripts/Editor/BuildEditor/BuildAssembliesHelper.cs

+ 15 - 6
Unity/Assets/Scripts/Editor/BuildEditor/BuildAssembliesHelper.cs

@@ -15,11 +15,15 @@ namespace ET
 
         public static void BuildModel(CodeOptimization codeOptimization, GlobalConfig globalConfig)
         {
-            string[] logicFiles = Directory.GetFiles(Define.BuildOutputDir, "Model_*");
-            foreach (string file in logicFiles)
+            try
             {
-                File.Delete(file);
+                string[] logicFiles = Directory.GetFiles(Define.BuildOutputDir, "Model_*");
+                foreach (string file in logicFiles)
+                {
+                    File.Delete(file);
+                }
             }
+            catch { }
 
             int random = RandomGenerator.RandomNumber(100000000, 999999999);
             string logicFile = $"Model_{random}";
@@ -69,11 +73,16 @@ namespace ET
 
         public static void BuildHotfix(CodeOptimization codeOptimization, GlobalConfig globalConfig)
         {
-            string[] logicFiles = Directory.GetFiles(Define.BuildOutputDir, "Hotfix_*");
-            foreach (string file in logicFiles)
+            try
             {
-                File.Delete(file);
+                string[] logicFiles = Directory.GetFiles(Define.BuildOutputDir, "Hotfix_*");
+                foreach (string file in logicFiles)
+                {
+                    File.Delete(file);
+                }
             }
+            catch { }
+
             string modelfile;
             string[] modelFiles = Directory.GetFiles(Define.BuildOutputDir, "Model_*.dll");
             if (modelFiles.Length > 0)