From 48ba7f76358f850240579772079f987a7a853eeb Mon Sep 17 00:00:00 2001 From: labbbirder <502100554@qq.com> Date: Thu, 8 Aug 2024 21:58:44 +0800 Subject: [PATCH] fix: console errors on first time launch --- Editor/EditorInitializer.cs | 11 ++++++----- .../Implements/EditorWeaveImplement.Incremental.cs | 12 +++++++----- package.json | 2 +- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/Editor/EditorInitializer.cs b/Editor/EditorInitializer.cs index 36e8123..2e04e5b 100644 --- a/Editor/EditorInitializer.cs +++ b/Editor/EditorInitializer.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using UnityEditor; using UnityEngine; @@ -13,11 +14,11 @@ static void EditorModeSetup() Logger.loggerLevel = UnityInjectionSettings.instance.loggerLevel; SetupImplements(); InjectionDriver.Instance.OnDomainReload(); - try - { - InjectionDriver.Instance.AutoInstallOnInitialize(); - } - catch { } + // try + // { + // InjectionDriver.Instance.AutoInstallOnInitialize(); + // } + // catch { } } [RuntimeInitializeOnLoadMethod] diff --git a/Editor/Implements/EditorWeaveImplement.Incremental.cs b/Editor/Implements/EditorWeaveImplement.Incremental.cs index 8222570..7b20fe2 100644 --- a/Editor/Implements/EditorWeaveImplement.Incremental.cs +++ b/Editor/Implements/EditorWeaveImplement.Incremental.cs @@ -47,16 +47,18 @@ public void OnDomainReload_Incremental() if (missingInjectionInfos.Length > 0) { SafelyWeaveInjectionInfos(missingInjectionInfos); - EditorApplication.delayCall += () => - { + EditorApplication.delayCall += #if UNITY_2019_3_OR_NEWER - EditorUtility.RequestScriptReload(); + EditorUtility.RequestScriptReload; #else - UnityEditorInternal.InternalEditorUtility.RequestScriptReload(); + UnityEditorInternal.InternalEditorUtility.RequestScriptReload; #endif - }; EditorApplication.QueuePlayerLoopUpdate(); } + else + { + InjectionDriver.Instance.AutoInstallOnInitialize(); + } // EphemeronSettings.instance.weavingRecords = allInjectionInfos // .Select(WeavingRecord.FromInjectionInfo) diff --git a/package.json b/package.json index aade27b..d88b859 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "com.bbbirder.unity-injection", "displayName": "Unity Injection V2", "description": "Unity注入模块,可以运行时改变被注入函数实现。", - "version": "2.0.16", + "version": "2.0.17", "hideInEditor": false, "author": "bbbirder <502100554@qq.com>", "dependencies": {