From 833debe445bb7590bbb21802bfeec4af7f1199df Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期五, 22 五月 2026 11:48:29 +0800
Subject: [PATCH] dll builtin区分开其他package的改动

---
 Assets/Launch/Manager/LocalResManager.cs     |  260 +++++++++++++++++++++++++------------
 Assets/Launch/Launch.cs                      |   45 ------
 Assets/Launch/Manager/YooAssetInitializer.cs |   56 ++++++--
 3 files changed, 219 insertions(+), 142 deletions(-)

diff --git a/Assets/Launch/Launch.cs b/Assets/Launch/Launch.cs
index abbe593..f388693 100644
--- a/Assets/Launch/Launch.cs
+++ b/Assets/Launch/Launch.cs
@@ -204,52 +204,11 @@
         System.Net.ServicePointManager.DefaultConnectionLimit = 100;
         StringUtility.WarmupPool();
 
-#if !UNITY_WEBGL && UNITY_EDITOR
-        //鍐呯綉涓嬭浇娴嬭瘯
-        _hotUpdateAss = System.AppDomain.CurrentDomain.GetAssemblies().First(a => a.GetName().Name == "Main");
-        Type type = _hotUpdateAss.GetType("InGameDownTestUtility");
-        LocalResManager.Instance.isPCTestDownLoad = (bool)type.GetMethod("GetReadVerionEx").Invoke(null, null);
-        LocalResManager.Instance.isOpenDownLoad = (bool)type.GetMethod("GetDownloadEnable").Invoke(null, null);
-#endif
         SDKInit();
         LocalResManager.Instance.Init();
-#if UNITY_WEBGL
-#if UNITY_EDITOR
-        // Editor WebGL 妯℃嫙锛歊eadText 璧扮墿鐞嗘枃浠讹紙涓嶉渶瑕� YooAsset锛夛紝鍙洿鎺� InitTable
-        LocalResManager.Instance.InitTable(async () =>
-        {
-            LocalResManager.Instance.InitDefaultLanguage();
-            launchExWin = await LaunchExWin.OpenWindow();
-            if (AssetSource.simulateWebGL)
-                LocalResManager.step = LocalResManager.LoadDllStep.RequestVersion;
-            else
-                StartGame();
-        }).Forget();
-#else
-        // 闈� Editor WebGL锛歊eadText 渚濊禆 YooAsset锛圥refabPackage锛夛紝浣嗘鏃� YooAsset 灏氭湭鍒濆鍖栥��
-        // 蹇呴』鍏堣蛋 RequestVersion 鈫� OnVersionCheckResult 鈫� InitYooAssetEarlyAsync锛�
-        // YooAsset 灏辩华鍚庡啀鐢� OnVersionCheckResult 鍐呯殑 InitTable 瀹屾垚閰嶇疆鍔犺浇銆�
+
+        // 浠讳綍閮借鍘昏姹傜増鏈俊鎭�
         LocalResManager.step = LocalResManager.LoadDllStep.RequestVersion;
-#endif
-#else
-#if UNITY_EDITOR
-        if (!LocalResManager.Instance.isOpenDownLoad)
-        {
-            // Editor 涓嶈蛋涓嬭浇娴佺▼锛欼nitTable 鐩存帴璇荤墿鐞嗘枃浠讹紙涓嶉渶瑕� YooAsset锛夛紝鐒跺悗鍚姩娓告垙
-            LocalResManager.Instance.InitTable(() =>
-            {
-                LocalResManager.Instance.InitDefaultLanguage();
-                launchExWin = LaunchExWin.OpenWindow();
-                StartGame();
-            }).Forget();
-        }
-        else
-#endif
-        {
-            // 姝e紡鍖� / Editor 涓嬭浇妯″紡锛氬厛璇锋眰鐗堟湰鑾峰彇 cdnUrl锛孻ooAsset 鍒濆鍖栧拰 InitTable 鍦� OnVersionCheckResult 涓墽琛�
-            LocalResManager.step = LocalResManager.LoadDllStep.RequestVersion;
-        }
-#endif
     }
 
     private void InitPlugins()
diff --git a/Assets/Launch/Manager/LocalResManager.cs b/Assets/Launch/Manager/LocalResManager.cs
index d4fe6dc..515161c 100644
--- a/Assets/Launch/Manager/LocalResManager.cs
+++ b/Assets/Launch/Manager/LocalResManager.cs
@@ -62,11 +62,6 @@
         }
     }
 
-#if UNITY_EDITOR && !UNITY_WEBGL
-    public bool isPCTestDownLoad = false;   //寮�鍚笅杞藉苟寮�鍚笅杞絙ytes
-    public bool isOpenDownLoad = false; //鍙紑鍚笅杞�
-#endif
-
     public static int downLoadCount = 0;
 
     public static readonly string[] VERSION_URL = new string[] 
@@ -144,7 +139,7 @@
     private const int YOO_MAX_RETRY = 3;
     private const int YOO_BASE_DELAY_MS = 500;
 
-    // package 涓� null 鏃堕粯璁や娇鐢� PrefabPackage锛圕onfig/Shader/Materials/ScriptableObject/Scenes 绛夛級
+    // package 涓� null 鏃堕粯璁や娇鐢ㄥ惎鍔ㄩ厤缃寘锛堝綋鍓嶄负 Builtin锛�
     // BuiltIn 璺緞涓嬬殑璧勬簮锛圫prites/Prefabs锛夊簲浼犲叆 DefaultPackage锛�= Builtin 鍖咃級
     private async UniTask<T> LoadAssetWithRetryAsync<T>(string location, ResourcePackage package = null) where T : UnityEngine.Object
     {
@@ -307,75 +302,182 @@
     /// </summary>
     private void OnVersionCheckResult(bool _ok, string _result)
     {
-        if (_ok)
+        if (!_ok)
         {
-            versionUrlResult = NormalizeVersionJson(_result);
-            if (string.IsNullOrEmpty(versionUrlResult))
+            RetryVersionCheck($"[LocalResManager] 鐗堟湰鎺ュ彛璇锋眰澶辫触锛寀rl={versionUrl}锛宔rror={_result}");
+            return;
+        }
+
+        versionUrlResult = _result;
+
+        // 鐗堟湰鎺ュ彛鏄惎鍔ㄩ摼璺叆鍙o細鍏堟嬁鍒板彲瑙f瀽鐨勭増鏈暟鎹紝鍐嶅厑璁稿悗缁祫婧愬垵濮嬪寲銆�
+        if (!TryUpdateVersionInfo(_result))
+        {
+            return;
+        }
+
+        Debug.Log("OK OnVersionCheckResult " + versionUrlResult);
+
+        // resource_url 浼氬喅瀹� YooAsset HostPlayMode 鐨勮繙绔牴璺緞锛屽繀椤诲湪鍒濆鍖� YooAsset 鍓嶅啓鍏ャ��
+        TryApplyCdnUrlFromVersionInfo();
+
+        // InitialFunction 鏄惎鍔ㄦ湡鍔熻兘寮�鍏冲拰璇█閰嶇疆锛汣DN 澶辫触鏃朵細鍥炶惤鍒板寘鍐呰〃锛岄伩鍏嶅惎鍔ㄥ崱姝汇��
+        LoadInitialFunctionAndStartAsync(BuildInitialFunctionUrl()).Forget();
+    }
+
+    private bool TryUpdateVersionInfo(string rawResult)
+    {
+        versionUrlResult = NormalizeVersionJson(rawResult);
+        if (string.IsNullOrEmpty(versionUrlResult))
+        {
+            RetryVersionCheck("[LocalResManager] 鏈嶅姟绔繑鍥炵┖鐗堟湰鏁版嵁锛岃妫�鏌ユ湇鍔$鏄惁宸查厤缃娓犻亾銆�");
+            return false;
+        }
+
+        try
+        {
+            versionInfo = JsonMapper.ToObject<VersionInfo>(versionUrlResult);
+            return true;
+        }
+        catch (Exception ex)
+        {
+            var firstChar = versionUrlResult.Length > 0 ? ((int)versionUrlResult[0]).ToString() : "<empty>";
+            var preview = versionUrlResult.Length > 32 ? versionUrlResult.Substring(0, 32) : versionUrlResult;
+            RetryVersionCheck($"[LocalResManager] Version json parse failed. firstChar={firstChar}, preview='{preview}', error={ex}");
+            return false;
+        }
+    }
+
+    private void TryApplyCdnUrlFromVersionInfo()
+    {
+        var versionConfig = VersionConfigEx.config;
+        if (versionInfo == null || versionConfig == null)
+        {
+            Debug.LogWarning("[LocalResManager] VersionInfo 鎴� VersionConfigEx 涓虹┖锛屽皢浣跨敤鏈湴/绂荤嚎璧勬簮妯″紡銆�");
+            return;
+        }
+
+        try
+        {
+            string resourceUrl = versionInfo.GetResourcesURL(versionConfig.branch);
+            if (string.IsNullOrEmpty(resourceUrl))
             {
-                Debug.LogError("[LocalResManager] 鏈嶅姟绔繑鍥炵┖鐗堟湰鏁版嵁锛岃妫�鏌ユ湇鍔$鏄惁宸查厤缃娓犻亾銆傚皢鍦�1绉掑悗閲嶈瘯...");
-                Clock.AlarmAt(DateTime.Now + new TimeSpan(TimeSpan.TicksPerSecond), RequestVersionCheck);
-                return;
-            }
-            try
-            {
-                versionInfo = JsonMapper.ToObject<VersionInfo>(versionUrlResult);
-            }
-            catch (Exception ex)
-            {
-                var firstChar = versionUrlResult.Length > 0 ? ((int)versionUrlResult[0]).ToString() : "<empty>";
-                var preview = versionUrlResult.Length > 32 ? versionUrlResult.Substring(0, 32) : versionUrlResult;
-                Debug.LogError($"[LocalResManager] Version json parse failed. firstChar={firstChar}, preview='{preview}', error={ex}");
+                Debug.LogWarning($"[LocalResManager] resource_url 涓虹┖锛屽皢浣跨敤鏈湴/绂荤嚎璧勬簮妯″紡銆俠ranch={versionConfig.branch}");
                 return;
             }
 
-            Debug.Log("OK OnVersionCheckResult " + _result);
+            versionConfig.cdnUrl = resourceUrl.TrimEnd('/');
+            Debug.Log($"[LocalResManager] 宸蹭粠 resource_url 璁剧疆 cdnUrl={versionConfig.cdnUrl} (branch={versionConfig.branch})");
+        }
+        catch (Exception urlEx)
+        {
+            Debug.LogWarning($"[LocalResManager] 鑾峰彇 resource_url 澶辫触锛屽皢浣跨敤鏈湴/绂荤嚎璧勬簮妯″紡: {urlEx.Message}");
+        }
+    }
 
-            // 浠庢湇鍔″櫒杩斿洖鐨� resource_url 涓彁鍙� CDN 鍦板潃锛屽啓鍏� VersionConfigEx 渚� YooAsset 鍒濆鍖栦娇鐢�
-            if (versionInfo != null && VersionConfigEx.config != null)
+    private string BuildInitialFunctionUrl()
+    {
+        var cdnUrl = VersionConfigEx.config?.cdnUrl;
+        if (string.IsNullOrEmpty(cdnUrl))
+        {
+            return string.Empty;
+        }
+
+        return cdnUrl.TrimEnd('/') + "/InitialFunction.txt";
+    }
+
+    private async UniTaskVoid LoadInitialFunctionAndStartAsync(string initFuncUrl)
+    {
+        bool configReady = await TryLoadInitialFunctionFromCdnAsync(initFuncUrl);
+        if (!configReady)
+        {
+            await TryLoadInitialFunctionFromResourcesAsync();
+        }
+
+        await InitializeYooAssetAndEnterReadBytesAsync();
+    }
+
+    private async UniTask<bool> TryLoadInitialFunctionFromCdnAsync(string initFuncUrl)
+    {
+        if (string.IsNullOrEmpty(initFuncUrl))
+        {
+            Debug.LogWarning("[LocalResManager] cdnUrl 涓虹┖锛岃烦杩� CDN InitialFunction.txt锛屽皾璇曡鍙栧寘鍐呴厤缃��");
+            return false;
+        }
+
+        var response = await HttpRequest.Instance.UnityWebRequestGetAsync(initFuncUrl, HttpRequest.defaultHttpContentType, 10);
+        if (!response.ok)
+        {
+            Debug.LogWarning($"[LocalResManager] 浠� CDN 鍔犺浇 InitialFunction.txt 澶辫触锛寀rl={initFuncUrl}锛宔rror={response.message}");
+            return false;
+        }
+
+        if (string.IsNullOrEmpty(response.message))
+        {
+            Debug.LogWarning($"[LocalResManager] CDN InitialFunction.txt 鍐呭涓虹┖锛寀rl={initFuncUrl}");
+            return false;
+        }
+
+        try
+        {
+            InitialFunctionConfig.Init(response.message);
+            Debug.Log($"[LocalResManager] 鎴愬姛浠� CDN 鍔犺浇 InitialFunction.txt锛寀rl={initFuncUrl}");
+            return true;
+        }
+        catch (Exception ex)
+        {
+            Debug.LogError($"[LocalResManager] 瑙f瀽 CDN InitialFunction.txt 澶辫触锛寀rl={initFuncUrl}锛宔rror={ex}");
+            return false;
+        }
+    }
+
+    private async UniTask<bool> TryLoadInitialFunctionFromResourcesAsync()
+    {
+        try
+        {
+            TextAsset textAsset = await Resources.LoadAsync<TextAsset>("Config/InitialFunction") as TextAsset;
+            if (textAsset == null || string.IsNullOrEmpty(textAsset.text))
             {
-// #if TEST_BUILD && UNITY_WEBGL
-                // 鏈湴娴嬭瘯锛氬己鍒朵娇鐢ㄦ湰鍦� CDN锛屽拷鐣ユ湇鍔″櫒杩斿洖鐨� resource_url
-                // VersionConfigEx.config.cdnUrl = "http://localhost:8081/";
-                // Debug.Log("[LocalResManager] TEST_BUILD+WebGL: 寮哄埗浣跨敤鏈湴 CDN http://localhost:8081/");
-// #else
-                try
-                {
-                    string resourceUrl = versionInfo.GetResourcesURL(VersionConfigEx.config.branch);
-                    if (!string.IsNullOrEmpty(resourceUrl))
-                    {
-                        VersionConfigEx.config.cdnUrl = resourceUrl;
-                        Debug.Log($"[LocalResManager] 宸蹭粠 resource_url 璁剧疆 cdnUrl={resourceUrl} (branch={VersionConfigEx.config.branch})");
-                    }
-                }
-                catch (Exception urlEx)
-                {
-                    Debug.LogWarning($"[LocalResManager] 鑾峰彇 resource_url 澶辫触锛屽皢浣跨敤 OfflinePlayMode: {urlEx.Message}");
-                }
-// #endif
+                Debug.LogWarning("[LocalResManager] 鍖呭唴 InitialFunction.txt 涓嶅瓨鍦ㄦ垨鍐呭涓虹┖锛屽皢缁х画鍚姩銆�");
+                return false;
             }
 
-            Launch.Instance.InitYooAssetEarlyAsync().ContinueWith(() =>
-            {
-                if (YooAssetInitializer.Instance.State != YooAssetInitializer.InitState.Ready)
-                {
-                    Debug.LogError($"[LocalResManager] YooAsset 鍒濆鍖栧け璐ワ紙State={YooAssetInitializer.Instance.State}锛夛紝鏃犳硶缁х画鍔犺浇璧勬簮");
-                    return;
-                }
-
-                // YooAsset 灏辩华鍚庯紝鍔犺浇閰嶇疆琛ㄥ苟鏄剧ず鍔犺浇鐣岄潰
-                InitTable(() =>
-                {
-                    InitDefaultLanguage();
-                    Launch.Instance.ShowLaunchUI();
-                    step = LoadDllStep.ReadBytes;
-                }).Forget();
-            }).Forget();
+            InitialFunctionConfig.Init(textAsset.text);
+            Debug.Log("[LocalResManager] 宸蹭娇鐢ㄥ寘鍐� InitialFunction.txt 鍒濆鍖栧惎鍔ㄩ厤缃��");
+            return true;
         }
-        else
+        catch (Exception ex)
         {
-            Debug.Log("http 鏁版嵁閫氳: VersionUtility:" + versionUrl + "  result:" + versionUrlResult);
-            Clock.AlarmAt(DateTime.Now + new TimeSpan(TimeSpan.TicksPerSecond), RequestVersionCheck);
+            Debug.LogError($"[LocalResManager] 璇诲彇鍖呭唴 InitialFunction.txt 澶辫触锛屽皢缁х画鍚姩銆俥rror={ex}");
+            return false;
         }
+    }
+
+    private async UniTask InitializeYooAssetAndEnterReadBytesAsync()
+    {
+        if (Launch.Instance == null)
+        {
+            Debug.LogError("[LocalResManager] Launch.Instance 涓虹┖锛屾棤娉曠户缁惎鍔ㄦ祦绋嬨��");
+            return;
+        }
+
+        await Launch.Instance.InitYooAssetEarlyAsync();
+        if (YooAssetInitializer.Instance.State != YooAssetInitializer.InitState.Ready)
+        {
+            Debug.LogError($"[LocalResManager] YooAsset 鍒濆鍖栧け璐ワ紙State={YooAssetInitializer.Instance.State}锛夛紝鏃犳硶缁х画鍔犺浇璧勬簮");
+            return;
+        }
+
+        // YooAsset 鐨� Manifest 灏辩华鍚庯紝鎵嶅彲浠ユ樉绀哄姞杞界晫闈㈠苟杩涘叆 DLL 璇诲彇闃舵銆�
+        InitDefaultLanguage();
+        Launch.Instance.ShowLaunchUI();
+        step = LoadDllStep.ReadBytes;
+    }
+
+    private void RetryVersionCheck(string message)
+    {
+        Debug.LogWarning(message + " 灏嗗湪1绉掑悗閲嶈瘯...");
+        Clock.AlarmAt(DateTime.Now + TimeSpan.FromSeconds(1), RequestVersionCheck);
     }
 
     private static string NormalizeVersionJson(string raw)
@@ -596,36 +698,24 @@
     // 閫氳繃 YooAsset 鍔犺浇 TextAsset 绫诲瀷鐨勬枃鏈枃浠躲��
     // location: 瀹屾暣鐨� YooAsset 璺緞锛屽 "Assets/ResourcesOut/Config/InitialFunction.txt"
     // Editor 涓嬬洿鎺ヨ鐗╃悊鏂囦欢锛堝墺绂� Assets/ 鍓嶇紑鍚庢嫾 Application.dataPath锛�
-    private async UniTask ReadText(string location, Action<bool, string> OnComplete = null)
+    private async UniTask ReadText(string fileName, Action<bool, string> OnComplete = null)
     {
         string content = string.Empty;
         bool result = false;
 
-#if UNITY_EDITOR
-        // location 褰㈠ "Assets/ResourcesOut/Config/Foo.txt" 鈫� 鐗╃悊璺緞
-        var editorPath = Application.dataPath + "/" + location.Substring("Assets/".Length);
-        if (File.Exists(editorPath))
-        {
-            content = File.ReadAllText(editorPath);
-            result = true;
-        }
-        else
-        {
-            Debug.LogError($"ReadText: file not found at '{editorPath}'");
-        }
-        await UniTask.Yield();
-#else
-#if UNITY_WEBGL || TEST_BUILD
-    Debug.Log($"[LocalResManager][Diag] ReadText via YooAsset location='{location}', state={YooAssetInitializer.Instance.State}");
-#endif
-        var textAsset = await LoadAssetWithRetryAsync<TextAsset>(location);
+        string path = "Config/" + fileName;
+
+        TextAsset textAsset = await Resources.LoadAsync<TextAsset>(path) as TextAsset; // 棰勭儹璧勬簮锛岄伩鍏嶅悗缁娆″姞杞芥椂鐨勯澶栧欢杩�
         if (textAsset != null)
         {
             content = textAsset.text;
             result = true;
-            Debug.Log($"ReadText '{location}' size:{content.Length}");
         }
-#endif
+        else
+        {
+            Debug.LogError("LoadResourceFailure " + path);
+        }
+
         OnComplete?.Invoke(result, content);
     }
 
@@ -644,7 +734,7 @@
 #endif
         }
 
-        await ReadText("Assets/ResourcesOut/Config/InitialFunction.txt", (isOK, value) =>
+        await ReadText("InitialFunction", (isOK, value) =>
         {
             if (isOK)
             {
diff --git a/Assets/Launch/Manager/YooAssetInitializer.cs b/Assets/Launch/Manager/YooAssetInitializer.cs
index ec5618b..51fd5da 100644
--- a/Assets/Launch/Manager/YooAssetInitializer.cs
+++ b/Assets/Launch/Manager/YooAssetInitializer.cs
@@ -37,21 +37,25 @@
     // Launch 绋嬪簭闆嗘棤娉曞紩鐢� Main 鐨� YooAssetPackageConfig锛屽湪姝ら噸澶嶅畾涔�
     // ====================================================================
 
-    /// <summary>榛樿鍖呭悕 鈥� Prefab 鍖呭惈鍚姩蹇呴渶璧勬簮</summary>
-    public const string DEFAULT_PACKAGE_NAME = "Builtin";
+    /// <summary>榛樿鍖呭悕 鈥� Builtin 鍖呭惈鍚姩蹇呴渶璧勬簮</summary>
+    public const string BUILTIN_PACKAGE_NAME = "Builtin";
 
-    public const string CONFIG_PACKAGE_NAME = "Prefab";
+    public const string DLL_PACKAGE_NAME = "Dll";
+
+    public const string DEFAULT_PACKAGE_NAME = BUILTIN_PACKAGE_NAME;
+
+    public const string CONFIG_PACKAGE_NAME = BUILTIN_PACKAGE_NAME;
 
     /// <summary>
     /// Launch 闃舵闇�瑕佸垵濮嬪寲鐨勫寘鍚嶏紙涓� Collector 涓�鑷达級銆�
     /// </summary>
-    private static readonly string[] LAUNCH_PACKAGES = new[] { "Prefab", "UI", "UIEffect", "Battle", "Audio", "Builtin", "Video", "Dll" };
+    private static readonly string[] LAUNCH_PACKAGES = new[] { BUILTIN_PACKAGE_NAME, DLL_PACKAGE_NAME };
 
     private EPlayMode _playMode;
     private IRemoteServices _remoteServices;
     private string _remoteCdnBaseUrl;
     private ResourcePackage _defaultPackage;
-    private ResourcePackage _prefabPackage;
+    private ResourcePackage _configPackage;
 
     private readonly Dictionary<string, ResourcePackage> _packages = new Dictionary<string, ResourcePackage>();
 
@@ -109,7 +113,11 @@
     /// </summary>
     public ResourcePackage DefaultPackage => _defaultPackage;
 
-    public ResourcePackage PrefabPackage => _prefabPackage;
+    public ResourcePackage BuiltinPackage => _defaultPackage;
+
+    public ResourcePackage DllPackage => GetPackage(DLL_PACKAGE_NAME);
+
+    public ResourcePackage PrefabPackage => _configPackage;
 
     /// <summary>
     /// 褰撳墠杩愯妯″紡
@@ -205,10 +213,10 @@
                         YooAssets.SetDefaultPackage(package);
                     }
 
-                    // CONFIG_PACKAGE_NAME 鍖呬綔涓洪厤缃寘
+                    // CONFIG_PACKAGE_NAME 鍖呬綔涓哄惎鍔ㄩ厤缃寘
                     if (pkgName == CONFIG_PACKAGE_NAME)
                     {
-                        _prefabPackage = package;
+                        _configPackage = package;
                     }
 
                     Debug.Log($"[YooAssetInitializer] Package '{pkgName}' initialized.");
@@ -331,7 +339,7 @@
                     if (_playMode == EPlayMode.HostPlayMode)
                     {
                         Debug.Log($"[YooAssetInitializer] HostPlayMode fallback: loading buildin manifest for '{pkgName}'");
-                        var fallbackVersionOp = package.RequestPackageVersionAsync(false);
+                        var fallbackVersionOp = package.RequestPackageVersionAsync(true);
                         await fallbackVersionOp.ToUniTask();
                         if (fallbackVersionOp.Status == EOperationStatus.Succeed)
                         {
@@ -339,6 +347,14 @@
                             await fallbackManifestOp.ToUniTask();
                             if (fallbackManifestOp.Status == EOperationStatus.Succeed)
                             {
+                                // Manifest 鏇存柊鎴愬姛鍚庢竻鐞嗘棫鐗堟湰缂撳瓨锛堥潪 Editor 妯″紡涓嬫墠鏈夌鐩樼紦瀛橈級
+#if !UNITY_EDITOR
+                                var fallbackClearBundleOp = package.ClearCacheFilesAsync(EFileClearMode.ClearUnusedBundleFiles);
+                                await fallbackClearBundleOp.ToUniTask();
+                                var fallbackClearManifestOp = package.ClearCacheFilesAsync(EFileClearMode.ClearUnusedManifestFiles);
+                                await fallbackClearManifestOp.ToUniTask();
+#endif
+
                                 Debug.Log($"[YooAssetInitializer] Package '{pkgName}' using buildin manifest v{fallbackVersionOp.PackageVersion}");
 #if UNITY_WEBGL || TEST_BUILD
                                 LogPackageState(pkgName, package, "fallback-manifest-success");
@@ -365,6 +381,14 @@
 #endif
                     continue;
                 }
+
+                // Manifest 鏇存柊鎴愬姛鍚庢竻鐞嗘棫鐗堟湰缂撳瓨锛堥潪 Editor 妯″紡涓嬫墠鏈夌鐩樼紦瀛橈級
+#if !UNITY_EDITOR
+                var clearBundleOp = package.ClearCacheFilesAsync(EFileClearMode.ClearUnusedBundleFiles);
+                await clearBundleOp.ToUniTask();
+                var clearManifestOp = package.ClearCacheFilesAsync(EFileClearMode.ClearUnusedManifestFiles);
+                await clearManifestOp.ToUniTask();
+#endif
 
                 Debug.Log($"[YooAssetInitializer] Package '{pkgName}' manifest updated to {packageVersion}.");
 #if UNITY_WEBGL || TEST_BUILD
@@ -402,7 +426,7 @@
         int assetTotalCount = -1;
         int bundleTotalCount = -1;
         string packageVersion = "manifest-null";
-        string initialFunctionValid = "not-prefab";
+        string initialFunctionValid = "not-config-package";
 
         try
         {
@@ -647,23 +671,26 @@
             case EPlayMode.WebPlayMode:
             {
                 var webParams = new WebPlayModeParameters();
+                var effectiveRemote = !string.IsNullOrEmpty(_remoteCdnBaseUrl)
+                    ? new UrlRemoteServices(_remoteCdnBaseUrl, _remoteCdnBaseUrl, packageName)
+                    : remoteServices;
 #if UNITY_WEBGL && WEIXINMINIGAME && !UNITY_EDITOR
                 // 寰俊灏忔父鎴忥細浣跨敤 WechatFileSystem 杩涜璧勬簮缂撳瓨
                 string packageRoot = $"{WeChatWASM.WX.env.USER_DATA_PATH}/__GAME_FILE_CACHE";
                 webParams.WebServerFileSystemParameters = WechatFileSystemCreater
-                    .CreateFileSystemParameters(packageRoot, remoteServices);
+                    .CreateFileSystemParameters(packageRoot, effectiveRemote);
 #elif UNITY_WEBGL && DOUYINMINIGAME && !UNITY_EDITOR
                 // 鎶栭煶灏忔父鎴忥細浣跨敤 TiktokFileSystem 杩涜璧勬簮缂撳瓨
                 string packageRoot = TTSDK.TTFileSystem.USER_DATA_PATH + "/__GAME_FILE_CACHE";
                 webParams.WebServerFileSystemParameters = TiktokFileSystemCreater
-                    .CreateFileSystemParameters(packageRoot, remoteServices);
+                    .CreateFileSystemParameters(packageRoot, effectiveRemote);
 #else
-                if (remoteServices != null)
+                if (effectiveRemote != null)
                 {
                     // 杩滅▼妯″紡锛圠ocalCDN/RemoteCDN锛夛細璧勬簮涓嶅湪 StreamingAssets锛�
                     // 璺宠繃 WebServerFileSystem锛屽彧鐢� WebRemoteFileSystem 浠� HTTP 鏈嶅姟鍣ㄥ姞杞�
                     webParams.WebServerFileSystemParameters = FileSystemParameters
-                        .CreateDefaultWebRemoteFileSystemParameters(remoteServices);
+                        .CreateDefaultWebRemoteFileSystemParameters(effectiveRemote);
                 }
                 else
                 {
@@ -685,6 +712,7 @@
     public void Release()
     {
         _defaultPackage = null;
+        _configPackage = null;
         _packages.Clear();
         _remoteServices = null;
         _remoteCdnBaseUrl = null;

--
Gitblit v1.8.0