From cd62c1dd9a5072372cf45e244446d65751f7f271 Mon Sep 17 00:00:00 2001 From: hevinci Date: Fri, 22 Apr 2022 16:43:09 +0800 Subject: [PATCH] Update AssetSystem --- Assets/YooAsset/Runtime/AssetSystem/AssetSystem.cs | 9 +++------ .../Runtime/AssetSystem/Provider/ProviderBase.cs | 4 ++-- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Assets/YooAsset/Runtime/AssetSystem/AssetSystem.cs b/Assets/YooAsset/Runtime/AssetSystem/AssetSystem.cs index d2c78f4..56bc1e2 100644 --- a/Assets/YooAsset/Runtime/AssetSystem/AssetSystem.cs +++ b/Assets/YooAsset/Runtime/AssetSystem/AssetSystem.cs @@ -12,7 +12,6 @@ namespace YooAsset private static readonly List _loaders = new List(1000); private static readonly List _providers = new List(1000); private static readonly Dictionary _sceneHandles = new Dictionary(100); - private static string _mainSceneName = string.Empty; /// /// 在编辑器下模拟运行 @@ -38,7 +37,6 @@ namespace YooAsset AssetLoadingMaxNumber = assetLoadingMaxNumber; DecryptionServices = decryptionServices; BundleServices = bundleServices; - _mainSceneName = SceneManager.GetActiveScene().name; } /// @@ -144,7 +142,6 @@ namespace YooAsset if (sceneMode == LoadSceneMode.Single) { UnloadAllScene(); - _mainSceneName = Path.GetFileName(scenePath); } ProviderBase provider = TryGetProvider(scenePath); @@ -154,7 +151,7 @@ namespace YooAsset provider = new DatabaseSceneProvider(scenePath, sceneMode, activateOnLoad, priority); else provider = new BundledSceneProvider(scenePath, sceneMode, activateOnLoad, priority); - provider.SetSpawnDebugInfo(_mainSceneName); + provider.InitSpawnDebugInfo(); _providers.Add(provider); } @@ -175,7 +172,7 @@ namespace YooAsset provider = new DatabaseAssetProvider(assetPath, assetType); else provider = new BundledAssetProvider(assetPath, assetType); - provider.SetSpawnDebugInfo(_mainSceneName); + provider.InitSpawnDebugInfo(); _providers.Add(provider); } return provider.CreateHandle() as AssetOperationHandle; @@ -193,7 +190,7 @@ namespace YooAsset provider = new DatabaseSubAssetsProvider(assetPath, assetType); else provider = new BundledSubAssetsProvider(assetPath, assetType); - provider.SetSpawnDebugInfo(_mainSceneName); + provider.InitSpawnDebugInfo(); _providers.Add(provider); } return provider.CreateHandle() as SubAssetsOperationHandle; diff --git a/Assets/YooAsset/Runtime/AssetSystem/Provider/ProviderBase.cs b/Assets/YooAsset/Runtime/AssetSystem/Provider/ProviderBase.cs index 0960641..cce422f 100644 --- a/Assets/YooAsset/Runtime/AssetSystem/Provider/ProviderBase.cs +++ b/Assets/YooAsset/Runtime/AssetSystem/Provider/ProviderBase.cs @@ -244,9 +244,9 @@ namespace YooAsset public string SpawnTime = string.Empty; [Conditional("DEBUG")] - public void SetSpawnDebugInfo(string spawnScene) + public void InitSpawnDebugInfo() { - SpawnScene = spawnScene; + SpawnScene = UnityEngine.SceneManagement.SceneManager.GetActiveScene().name; ; SpawnTime = SpawnTimeToString(UnityEngine.Time.realtimeSinceStartup); } private string SpawnTimeToString(float spawnTime)