Sfoglia il codice sorgente

修复编辑器下使用Log报错

tanghai 2 anni fa
parent
commit
bba1fc182c
1 ha cambiato i file con 7 aggiunte e 9 eliminazioni
  1. 7 9
      Unity/Assets/Scripts/Editor/Helper/EditorLogHelper.cs

+ 7 - 9
Unity/Assets/Scripts/Editor/Helper/EditorLogHelper.cs

@@ -39,22 +39,20 @@ namespace ET
 
         private static void CreateLog()
         {
-            if (Logger.Instance != null)
+            if (Logger.Instance == null)
             {
-                return;
+                World.Instance.AddSingleton<Logger>().Log = new UnityLogger();
             }
 
-            World.Instance.AddSingleton<Logger>().Log = new UnityLogger();
+            if (Options.Instance == null)
+            {
+                World.Instance.AddSingleton(new Options());
+            }
         }
 
         private static void DestroyLog()
         {
-            if (Logger.Instance == null)
-            {
-                return;
-            }
-
-            Logger.Instance.Dispose();
+            World.Instance.Dispose();
         }
     }
 }