From 9be9c28582e8f44b098da3f55f81980fb54f7581 Mon Sep 17 00:00:00 2001 From: Tungdv Date: Fri, 8 May 2026 11:20:02 +0700 Subject: [PATCH] fix: update summary for funtion loading asset. --- .../PerfectWorld/Scripts/World/LitModelHolder.cs | 16 +++++++++------- .../PerfectWorld/Scripts/World/TerrainHolder.cs | 10 ++++++++-- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/Assets/PerfectWorld/Scripts/World/LitModelHolder.cs b/Assets/PerfectWorld/Scripts/World/LitModelHolder.cs index 5cfe319733..70038d877f 100644 --- a/Assets/PerfectWorld/Scripts/World/LitModelHolder.cs +++ b/Assets/PerfectWorld/Scripts/World/LitModelHolder.cs @@ -285,14 +285,7 @@ public class LitModelHolder : MonoSingleton } _needToProcessLoadAndUnload = true; - //if (_hostPlayer != null) - //{ - // Debug.LogError("ProcessLoadAndUnload Lit _hostPlayer.isLitToReady = false "); - // _hostPlayer.isLitToReady = false; - //} } - int _currentIdxAsset = 0; - int _maxIdxAsset = 0; private void ProcessLoadAndUnloadObjects() { @@ -317,6 +310,14 @@ public class LitModelHolder : MonoSingleton _objectsToUnload.Clear(); } + int _currentIdxAsset = 0; // The current counter for loaded assets. + int _maxIdxAsset = 0; // Limit the number of assets that have finished loading. + + /// + /// isLitToReady is a condition used by _hostPlayer to wait until the Lit assets have finished loading. + /// This function counts the number of assets successfully loaded from the Addressable system, + /// and once the required number is reached, it sets _hostPlayer.isLitToReady = true. + /// private void CallBackAssetLoadingDone() { _currentIdxAsset++; @@ -330,6 +331,7 @@ public class LitModelHolder : MonoSingleton _maxIdxAsset = 0; } } + /// /// Get the Host Player instance. /// diff --git a/Assets/PerfectWorld/Scripts/World/TerrainHolder.cs b/Assets/PerfectWorld/Scripts/World/TerrainHolder.cs index edc0a669a7..8cfe0ed009 100644 --- a/Assets/PerfectWorld/Scripts/World/TerrainHolder.cs +++ b/Assets/PerfectWorld/Scripts/World/TerrainHolder.cs @@ -183,8 +183,6 @@ namespace BrewMonster } - int _currentIdxAsset = 0; - int _maxIdxAsset = 0; /// /// process to call Load and Unload on each addressable object that we need to. /// @@ -205,6 +203,14 @@ namespace BrewMonster _objectsToUnload.Clear(); } + int _currentIdxAsset = 0; // The current counter for loaded assets. + int _maxIdxAsset = 0; // Limit the number of assets that have finished loading. + + /// + /// isLitToReady is a condition used by _hostPlayer to wait until the Terrain assets have finished loading. + /// This function counts the number of assets successfully loaded from the Addressable system, + /// and once the required number is reached, it sets _hostPlayer.isLitToReady = true. + /// private void CallBackAssetLoadingDone() { _currentIdxAsset++;